Alice was bored with the game tic-tac-toe. Usually she used to play against computer. She was so bored because, she always managed to make a tie against computer as she already became an expert in this game. She was also bored about the matching things, that means she does not like to see two adjacentX
s or two adjacent O
s. So Bob created a new computer game for her.
Here is the description of this new 2-player game:
- A 1 x N grid will be given.
- In each turn, a player can mark an unmarked cell by an
X
or by anO
(it's not a Zero it is a bigO
). - No two adjacent
X
s are allowed in this game. - No two adjacent
O
s are allowed in this game. - The player who marks the last cell wins the game.
Let's have an example for N = 3. Suppose first player mark the leftmost cell with an X
. Then the grid will look like this:
From this state, the winning move of the second player is to mark the rightmost cell with an O
.
Now first player has no move, because in the only empty cell she cannot mark X
and cannot mark O
because the left of this cell is already marked X
and the right of this cell is marked O
. The second player will win.
But this is not an optimal example for first player. If in first move, the first player marks the middle cell with any one of X
or O
, she will win.
Now, Alice always makes the first move. Alice usually used to start playing with Bob. But most often after some move, Bob gave his responsibility to the computer. Computer always plays optimally. You are given the state of the grid after Bob's departure and your task is to determine whether it is possible to win against computer from this state for Alice.
Input
Input starts with an integer T (≤ 10000), denoting the number of test cases.
Each case starts with a line containing a string which represents the state of the game after Bob's departure. Here the length of the string is N (1 ≤ N ≤ 100). In this string besides X
and O
, another character .
is used, which represents an unmarked cell.
Output
For each case, print the case number and Yes
if it is possible to win against computer, otherwise print No
.
Sample
Sample Input | Sample Output |
---|---|
5 ... X.. ....O ..X.. O | Case 1: Yes Case 2: No Case 3: No Case 4: Yes Case 5: Yes |