1612 - A new tree game
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 147
Solved: 42
- Description
- tclsm and littleSheep want to play an interesting game on a tree.Given is a tree on N vertices, The vertices are numbered from 0 to N - 1. vertex 0 represents the root. There are N-1 edges. Players alternate in making moves, tclsm moves first. A move consists of two steps. In the first step the player selects an edge and cuts it from the tree. In the second step he/she removes all the edges that are no longer connected to the root. The player who has no edge to remove loses.You know this game is so easy for GodSheep so tclsm wants to Strengthen the game.So tclsm defines a K represents an edge need to cut K times before breaking.
You may assume that both tclsm and littleSheep play optimally.
- Input
- The first line of the input file contains an integer T (T<=50) specifying the number of test cases.
Each test case begins with a line containing an integer N (1<=N<=10^4), the number of vertices,The following N-1 lines each contain two integers I , J(0<=I, J<N), which means I is connected with J. You can assume that there are no loops in the tree.And following a line contain an integer Q (1<=Q<=10^4), the number of querys.The following Q lines each contain an integer K(1<=K<=Q), which means Edges's weight is K.
- Output
- For each query, output a single line containing the name of the player who will win the game.3
- sample input
-
2 3 1 0 1 2 2 1 2 3 0 1 0 2 1 1
- sample output
-
tclsm littleSheep littleSheep
- hint
- source
- The 7th(2012) ACM Programming Contest of HUST Problem Setter: Shunmin Li