Alice and Bob is a playing a game of tic-tac-toe, to be precise a variant of tic-tac-toe called Notakto. In a game of Notakto, there will always be a winner.
Notakto is played on 3×3 tic-tac-toe board with both players playing X. A game ends when the board contains three consecutive X, at which point the player to have made the last move loses the game.
Given a configuration of the board, you have to find out the winner. Alice always makes the first move.
You are given an integer n (0 < n < 200), number of games.
For each game, you are given a 3×3 grid, each grid cell is empty (denoted by dot), or occupied by a cross (denoted by X).
For each game, print the winner of that game, in the format "Game #x: winner". Here, x is the game number.
Input | Output |
---|---|
1 .X. .X. ..X | Game #1: Bob |
Input | Output |
---|---|
2 .X. .XX X.X ... .XX ... | Game #1: Bob Game #2: Alice |