Tom and Jerry recently saw the movie inception. Inspired by that movie they decided to play a complicated game. Analogous to the movie inception, Jerry is the dreamer and Tom is the thief who enters Jerry's dream in order to extract the secret code. Tom wins the game if he is able to extract the secret code, else Jerry wins the game. Note that here Tom has to extract the idea from Jerry. Tom after performing a lot of mathematical analysis finally ended up to one last step for which he requires a little computation. He has got an array of positive integers. If atleast one of them is prime, he will be able to crack the secret code and win the game, else Jerry wins the game. Input The first line contains a single integer t (1≤t≤106) the number of test cases. Description of each test case is as follows. The first line of each test case contains a single integer n (1≤n≤2⋅106) the number of elements in the array. The second line of each test case contains n positive integers a1,a2,...,an(1≤a≤106). It is guaranteed that the sum of n over all test cases doesn't exceed 2⋅106. Output For each test case output "Tom" (without quotes) if Tom wins the game, else output "Jerry" (without quotes). Example input 3 3 1 2 4 5 1 4 8 9 18 4 2 4 12 20 output Tom Jerry Tom

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter17: Markov Chains
Section: Chapter Questions
Problem 12RP
icon
Related questions
Question

Tom and Jerry recently saw the movie inception. Inspired by that movie they decided to play a complicated game.

Analogous to the movie inception, Jerry is the dreamer and Tom is the thief who enters Jerry's dream in order to extract the secret code. Tom wins the game if he is able to extract the secret code, else Jerry wins the game. Note that here Tom has to extract the idea from Jerry.

Tom after performing a lot of mathematical analysis finally ended up to one last step for which he requires a little computation. He has got an array of positive integers. If atleast one of them is prime, he will be able to crack the secret code and win the game, else Jerry wins the game.

Input

The first line contains a single integer t (1≤t≤106) the number of test cases. Description of each test case is as follows.

The first line of each test case contains a single integer n (1≤n≤2⋅106) the number of elements in the array.

The second line of each test case contains n positive integers a1,a2,...,an(1≤a≤106).

It is guaranteed that the sum of n over all test cases doesn't exceed 2⋅106.

Output

For each test case output "Tom" (without quotes) if Tom wins the game, else output "Jerry" (without quotes).

Example

input

3

3

1 2 4

5

1 4 8 9 18

4

2 4 12 20

output

Tom

Jerry

Tom

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage