#868
Bronze I
MARATON
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

Albert, Barbara, Casper, Dinko, Eustahije are starting a marathon game of tic-tac-toe, played on an N×NN \times N board.

Initially, all squares on the board are empty and players take turns writing the first letter of their name into any of the empty squares (because the players are elite, no two players have the same first letter).

The game ends when some player places 3 of his or her letters consecutively in a row, column or diagonally. That player is declared the winner.

Write a program that, given the state of the board, determines if the game is over and who won if it is.

입력

The first line of input contains the integer NN (1N301 \le N \le 30), the size of the board.

The following NN lines contain NN characters each. The characters will be uppercase letters of the English alphabet or '.' (if the square is empty).

The input data will be such that there is at most one winner.

출력

If the game is over, output the first letter of the winner's name. If not, output "ongoing" (even if the board is full).

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Bronze I1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.