Moving on grid
Easy Accuracy: 16.39% Submissions: 232 Points: 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

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.