|
|||
Tic-Tac-ToeEveryone is familiar with the children's game of Tic-Tac-Toe. One player is X, the other player is O. The players in turn (X goes first) place their mark in a previously unoccupied square of a 3 × 3 grid. A player who gets three of his marks in a row, across, down, or diagonally, wins the game. There are 8 ways to win. If the board is filled without either player getting 3 in a row, the game “goes to the cat,” and there is no winner. Given a valid configuration of the board at some point during a game, you are to determine, assuming both players make their best possible moves for the remainder of the game, which player will win or whether the game will go to the cat. Input Specification
The first line of the input will consist of a decimal integer N between 1 and 100
inclusive, representing the number of test cases to follow. What will then follow are
N lines, each 9 characters long. These 9 characters will be from { Output Specification
The test cases in the output should appear in the order in which they appear in the input.
For each test case, you are to print one of the following strings: “ Sample Input
Output for Sample Input
Original Problem |
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |