406329: GYM102361 K MUV LUV UNLIMITED

Memory Limit:1024 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. MUV LUV UNLIMITEDtime limit per test1 secondmemory limit per test1024 megabytesinputstandard inputoutputstandard output

There are few entertainments in United Nations 11th Force, Pacific Theater, Yokohama Base, the only pastime for squad 207 is gathering in PX to play games after supper. However, whatever they play, Shirogane Takeru is always the loser. So he decides to use the game theory knowledge from another world to become the winner. According to the knowledge he has learnt, Takeru introduces his army friends a game:

Given a rooted tree of size $$$n$$$, whose root is vertex 1. Two players do operations on the tree alternately. In each operation, a player should choose several (at least one) leaf vertices (which have no children vertices) and remove them from the tree. As can be seen, there might be some new leaf vertices after one operation. The player who cannot make a move in his/her turn loses the game.

But unfortunately, Takeru doesn't master the knowledge skillfully, so he has no idea whether the first player will win if the two players are playing optimally. Please help him determine that.

Assume that the two players are playing optimally to make themselves win, print "Takeru" in a single line if the first player will win, or print "Meiya" otherwise.

Input

The first line contains one positive integer $$$T$$$, denoting the number of test cases.

For each test case:

The first line contains one positive integer $$$n~(2\le n \le 10^6)$$$, denoting the size of the given tree.

The next line contains $$$n-1$$$ positive integers $$$p_i~(1\le p_i \le n)$$$, where $$$i$$$-th integer denotes the parent vectex of vectex $$$i+1$$$.

It is guaranteed that the sum of $$$n$$$ among all cases in one test file does not exceed $$$10^6$$$.

Output

Output $$$T$$$ lines each contains a string "Takeru" or "Meiya", denoting the answer to corresponding test case.

ExampleInput
2
3
1 1
4
1 2 3
Output
Takeru
Meiya
Note

For the first case, the first player can remove vertex 3 firstly. As a result, the second player has no choice but to remove vertex 2. Finally, the first player removes vertex 1 and becomes the winner.

For the second case, the two players can only remove exactly one vertex in each operation alternately. As can be seen, the winner, who removes vertex 1, will be the second player.

加入题单

上一题 下一题 算法标签: