F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

MUV LUV UNLIMITED

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 549    Accepted Submission(s): 192


Problem Description
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 ¡Ü n ¡Ü $10^6$), denoting the size of the given tree.
The next line contains n 1 positive integers pi (1 ¡Ü pi ¡Ü 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.
 

Sample Input
2 3 1 1 4 1 2 3
 

Sample Output
Takeru Meiya
 

Hint

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.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 07:03:44, Gzip enabled