Cycle Race
Submissions: 1406   Accuracy:

42.83%

  Difficulty: Easy   Marks: 2

In CycleLand Jack and Jelly are two friends. They want to go CycleSchool by a cycle ( Assume that they live in same house). Distance between CycleSchool and their house is 'N' km. Jack and Jelly both like their classmate Jenny. They decided to play a game such that the winner will get a chance to sit with Jenny in school. Rules of game are as follows:
  - Initially Jelly will ride cycle.
  - They will ride cycle one by one.
  - When one is riding cycle other will sit on the carrier of cycle.  
  - In each ride they can ride cycle exactly 1, 2 or 4 km. One cannot ride more than remaining distance.      
  - One who reaches school riding cycle will get a chance to sit with Jenny.
Both play optimally. You have to find who will win this game.

Input:
First line of input contains an integer 'T' denoting the number of test cases. Then 'T' test cases follow. Each test case consists of a single line containing an integer N.

Output:
Print the name of winner i.e 'JACK' or 'JELLY'.

Constraints:
1<=T<=100
1<=N<=10000000

Example:
Input

3
2
3     

Output:
JELLY
JACK
JELLY

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Raju Varshney
Author: vaibhav2992


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.