Marathon Tic-Tac-Toe

Time limit1sMemory limit128 MB

Problem

Marathon Tic-Tac-Toe is played on an N×N board.

At first, every cell is empty. On each turn, a player chooses one empty cell and writes the first letter of their English name in it. No two players use the same letter.

If three equal letters appear consecutively in a row, column, or diagonal, the player using that letter wins and the game ends.

Given the current board, determine whether there is already a winner. If there is, output the winning letter.

Input

The first line contains the board size N. (1 ≤ N ≤ 30)

The next N lines describe the board. A . means an empty cell, and any other character is a player's letter.

The given board contains at most one winner.

Output

If the game has ended, print the winning player's letter on the first line.

If there is no winner, print ongoing, even when the board has no empty cells.