#abc278g. [abc278_g]Generalized Subtraction Game

[abc278_g]Generalized Subtraction Game

Problem Statement

This is an interactive task (where your program interacts with the judge's program via Standard Input and Output).

You are given integers NN, LL, and RR.
You play the following game against the judge:

There are NN cards numbered 11 through NN on the table.
The players alternately perform the following operation:

  • choose an integer pair (x,y)(x, y) satisfying 1leqxleqN1 \\leq x \\leq N, LleqyleqRL \\leq y \\leq R such that all of the yy cards x,x+1,dots,x+y1x, x+1, \\dots, x+y-1 remain on the table, and remove cards x,x+1,dots,x+y1x, x+1, \\dots, x+y-1 from the table.

The first player to become unable to perform the operation loses, and the other player wins.

Choose whether to go first or second, and play the game against the judge to win.

Constraints

  • 1leqNleq20001 \\leq N \\leq 2000
  • 1leqLleqRleqN1 \\leq L \\leq R \\leq N
  • NN, LL, and RR are integers.

Input and Output

This is an interactive task (where your program interacts with the judge's program via Standard Input and Output).

Initially, receive NN, LL, and RR, given from the input in the following format:

NN LL RR

First, you choose whether to go first or second. Print First if you choose to go first, and Second if you choose to go second.

Then, the game immediately starts. If you choose to go first, the judge goes second, and vice versa. You are to interact with the judge via input and output until the game ends to win the game.

In your turn, print an integer pair (x,y)(x, y) that you choose in the operation in the following format. If there is no (x,y)(x, y) that you can choose, print (x,y)=(0,0)(x, y) = (0, 0) instead.

xx yy

In the judge's turn, the judge print an integer pair (a,b)(a, b) in the following format:

aa bb

Here, it is guaranteed that (a,b)(a, b) is of one of the following three kinds.

  • If (a,b)=(0,0)(a, b) = (0, 0): the judge is unable to perform the operation. In other words, you have won the game.
  • If (a,b)=(1,1)(a, b) = (-1, -1): you have chosen an illegal (x,y)(x, y) or printed (0,0)(0, 0). In other words, you have lost the game.
  • Otherwise: the judge has performed the operation with (x,y)=(a,b)(x,y) = (a,b). It is guaranteed that judge chooses valid (x,y)(x, y).

If the judge returns (a,b)=(0,0)(a,b)=(0,0) or (a,b)=(1,1)(a,b)=(-1,-1), the game has already ended. In that case, terminate the program immediately.

Notes

  • After each output, add a newline and then flush Standard Output. Otherwise, you may get a TLE