Problem: The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.
Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on Codeforces.
In a Tic-Tac-Toe grid, there are rows and columns. Each cell of the grid is either empty or contains a token. There are two types of tokens: X and O. If there exist three tokens of the same type consecutive in a row or column, it is a winning configuration. Otherwise, it is a draw configuration.
The patterns in the first row are winning configurations. The patterns in the second row are draw configurations.
In an operation, you can change an X to an O, or an O to an X. Let denote the total number of tokens in the grid. Your task is to make the grid a draw in at most (rounding down) operations.
You are not required to minimize the number of operations.
Input Format: The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer () — the size of the grid.
The following lines each contain a string of characters, denoting the initial grid. The character in the -th row and -th column is '.' if the cell is empty, or it is the type of token in the cell: 'X' or 'O'.
It is guaranteed that not all cells are empty.
The sum of across all test cases does not exceed .
Output Format: For each test case, print the state of the grid after applying the operations.
We have proof that a solution always exists. If there are multiple solutions, print any.
Note: In the first test case, there are initially three 'O' consecutive in the second row and the second column. By changing the middle token to 'X' we make the grid a draw, and we only changed token.
In the second test case, the final grid is a draw. We only changed tokens.
In the third test case, the final grid is a draw. We only changed tokens.