|
||||||||||
Fishhead¡¯s Little GameTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1438 Accepted Submission(s): 423 Problem Description ¡¡¡¡¡¡There is a 3 by 3 grid and each vertex is assigned a number. ¡¡¡¡¡¡It looks like JiuGongGe, but they are different, for we are not going to fill the cell but the edge. For instance, ¡¡¡¡¡¡The rule of this game is that each player takes turns to add an edge. You will get one point if the edge you just added, together with edges already added before, forms a new square (only square of size 1 is considered). Of course, you get two points if that edge forms two squares. Notice that an edge can be added only once. ¡¡¡¡Tom200 and Jerry404 is playing this little game, and have played n rounds when Fishhead comes in. Fishhead wants to know who will be the winner. Can you help him? Assume that Tom200 and Jerry404 are clever enough to make optimal decisions in each round. Every Game starts from Tom200. Input ¡¡¡¡The first line of the input contains a single integer T (T <= 100), the number of test cases. ¡¡¡¡For each case, the first line contains an integers n (12 <= n <= 24), which means they have taken total n rounds in turn. Next n lines each contains two integers a, b (a, b <= 16) representing the two endpoints of the edge. Output ¡¡¡¡For each case output one line "Case #X: ", representing the Xth case, starting from 1. If Tom200 wins, print "Tom200" on one line, print "Jerry404" otherwise. Sample Input
Sample Output
Hint ¡¡¡¡In case 1, Tom200 gets two points when she add edge 5 -> 6, two points in edge 6 -> 7, one point in 4 -> 8. Source | ||||||||||
|