Moving on grid
Submissions: 192   Accuracy:

15.61%

  Difficulty: Easy   Marks: 2

Given a grid with dimensions R x C, the 2 players (say JON and ARYA ) can move the coin over the grid satisfying the following rules:

  • There is coin on (1,1) cell initially.
  • JON will move first.
  • Both will play on alternate moves.
  • In each move they can place coin on following positions if current position of coin is x,y
     x+1,y
    x+2,y
    x+3,y
    x,y+1
    x,y+2
    x,y+3
    x,y+4
    x,y+5
    x,y+6
     
  • Player who cannot make any move will lose this game.
  • ‚ÄčBoth play optimally.

Input:

The first line of the input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of a single line contaning 2 space seperated integers C and R.

Output:
For each test case, output the name of the winner ( either JON or ARYA)

Constraints:
1<=T<=100
1<=R,C<=100000

Example:
Input:
2
1 2
2 2

Output:
JON
ARYA

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

Contributor: Raju Varshney
Author: AdityaChatterjee


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.