Chandu and Chandni
Practice
4 (11 votes)
Algorithms
Approved
Math
Medium
Open
Problem
49% Success 2229 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Chandu and chandni are playing a game ! Game is very similar to the game of chess, But there is only one piece on the board i.e Queen. Also, Queen is allowed to move only towards top left corner..
For clarification, If Queen is placed at i,j then in a turn queen can move:
1) Any number of cells leftwards.
2) Any number of cells upwards.
3) Any number of cells Diagonally(only N-W direction).

Please note that board is quarter infinite i.e there is a top left corner but it extends to infinity in south and east direction..

Rules:
1) Chandni will always play the first turn.
2) They both will get alternative turns.
3) They must move the queen in their turn (No skip option) and that too according to the rule specified above.
4) Whosoever is unable to make a move loses.

Given The position of queen on the board(0 index based). Print who will win the game.

Input:
First line of input contains an integer t - no of test cases.
Each test case is described as a line containing two integers a and b. which is the position of queen on the board.

Output:
print the name of person who will win the game.

Constraints:
1<=t<=10000
0<=a,b<=1000000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
48 votes
Tags:
Ad-HocAlgorithmsApprovedHash MapsMediumOpen
Points:30
19 votes
Tags:
Data StructuresHash MapsHash TablesMedium
Points:30
88 votes
Tags:
ApprovedBinary SearchMediumOpenSorting