Tic-tac-toe
Once, Slava and Seva were strolling down the street when they noticed a notebook left on a bench. Curious, they opened it and found a series of mysterious numbers. Initially, they suspected it might be a secret message from a spy. Just as they were about to leave, the notebook's owner returned and clarified that the numbers were simply records of moves from the game "Gomoku."
Gomoku, a variant of tic-tac-toe, is a strategic game played by two opponents on an infinite rectangular board. One player uses "crosses," while the other uses "noughts." Players alternate turns, placing their symbols in empty cells. The objective is to be the first to align a row of 5 or more of their symbols either vertically, horizontally, or diagonally. The player with crosses always starts the game.
Intrigued by the game, the friends wanted to find out who won. They decided to write a program to determine the winner, especially considering the vast size of the board. By evening, they had figured out the winner.
Can you solve this challenge?
Input
The first line contains an integer n (0 ≤ n ≤ 10000) - the number of moves made. Each of the following n lines contains two integers x and y (|x|, |y| ≤ 10^9) - the coordinates of the cell where the next symbol was placed.
Output
Print "First player won" if the first player won, and "Second player won" if the second player was victorious. If neither player managed to win, print "Draw". If at any point five identical symbols align in a row, but the game continues with more moves, print "Inconsistent". It is guaranteed that no player places a symbol in an already occupied cell. The board starts empty.