PivotOJ

Grid Game 2

시간 제한: 2000ms메모리 제한: 1024MB출처: ICPC Asia Jakarta Regional 2023BOJ 32082

문제

You are playing “Grid Game 2” with your friend. There is a grid with 10910^9 rows (numbered from 11 to 10910^9) and 10910^9 columns (numbered from 11 to 10910^9). The cell at row rr and column cc is denoted as (r,c)(r, c).

Each cell can have a colour of either black or white. Initially, there are exactly NN black cells (numbered from 11 to NN). Black cell ii is located at (Ri,Ci)(R_i , C_i). The rest of the cells are white.

You and your friend will alternately take turn playing on this grid, and you are playing in the first turn. In one turn, a player will choose a black cell (r,c)(r, c), then toggle cells (rx,cy)(r - x, c - y) for all 0 &le; x, y < \min(r, c). If a cell is toggled, then the cell becomes black if it was a white cell, and the cell becomes white if it was a black cell.

For example, the following illustration shows how the grid changes after a player chooses a black cell (5,4)(5, 4) in their turn.

A player who is unable to play on their turn, i.e. no remaining black cells, loses the game, and the opposing player wins the game. If you and your friend are playing optimally, determine who will win the game.

입력

The first line consists of an integer NN (1 &le; N &le; 200\, 000).

Each of the next NN lines consists of two integers RiR_i CiC_i (1 &le; R_i , C_i &le; 10^9). For 1 &le; i < j &le; N, (Ri,Ci)(Rj,Cj)(R_i , C_i) \ne (R_j , C_j ).

출력

Output FIRST if you will win the game, or SECOND otherwise.

예제

예제 1

입력
2
2 3
2 4
출력
FIRST

예제 2

입력
1
2 2
출력
SECOND

예제 3

입력
13
1 1
1 4
1 5
2 1
2 4
2 5
4 1
4 2
4 4
5 1
5 2
5 4
5 5
출력
SECOND
코드를 제출하려면 로그인하세요.