eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

A Coloring Game

A Coloring Game

Two players play a graph coloring game. They make moves in turn, first player moves first. Initially they take some undirected graph. At each move, a player can color an uncolored vertex with either white or black color (each player can use any color, possibly different at different turns). It’s not allowed to color two adjacent vertices with the same color. A player that can’t move loses. After playing this game for some time, they decided to study it. For a start, they’ve decided to study very simple kind of graph --- a chain. A chain consists of \textbf{N} vertices, \textbf{v_1}, \textbf{v_2}, ..., \textbf{v_N}, and \textbf{N-1} edges, connecting \textbf{v_1} with \textbf{v_2}, \textbf{v_2} with \textbf{v_3}, ...,\textbf{v_\{N-1\}} with \textbf{v_N}. Given a position in this game, and assuming both players play optimally, who will win? \InputFile The first line of the input file contains the integer \textbf{N}, \textbf{1} ≤ \textbf{N} ≤ \textbf{100000}. The second line of the input file describes the current position. It contains \textbf{N} digits without spaces. \textbf{i}^th digit describes the color of vertex \textbf{v_i}: \textbf{0} --- uncolored, \textbf{1} --- black, \textbf{2} --- white. No two vertices of the same color are adjacent. \OutputFile On the only line of the output file, print "\textbf{FIRST}" (without quotes) if the player moving first in that position wins the game, and "\textbf{SECOND}" (without quotes) otherwise.
Ліміт часу 0.5 секунд
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
5
00100
Вихідні дані #1
SECOND