1450_C1. Errich-Tac-Toe (Easy Version)
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 n rows and n 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.

<image> 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 k denote the total number of tokens in the grid. Your task is to make the grid a draw in at most ⌊ k/3⌋ (rounding down) operations.

You are not required to minimize the number of operations.

Input

The first line contains a single integer t (1≤ t≤ 100) — the number of test cases.

The first line of each test case contains a single integer n (1≤ n≤ 300) — the size of the grid.

The following n lines each contain a string of n characters, denoting the initial grid. The character in the i-th row and j-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.

In the easy version, the character 'O' does not appear in the input.

The sum of n across all test cases does not exceed 300.

Output

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.

Example

Input


3
3
.X.
XXX
.X.
6
XX.XXX
XXXXXX
XXX.XX
XXXXXX
XX.X.X
XXXXXX
5
XXX.X
.X..X
XXX.X
..X..
..X..


Output


.X.
XOX
.X.
XX.XXO
XOXXOX
OXX.XX
XOOXXO
XX.X.X
OXXOXX
XOX.X
.X..X
XXO.O
..X..
..X..

Note

In the first test case, there are initially three 'X' consecutive in the second row and the second column. By changing the middle token to 'O' we make the grid a draw, and we only changed 1≤ ⌊ 5/3⌋ token.

In the second test case, we change only 9≤ ⌊ 32/3⌋ tokens, and there does not exist any three 'X' or 'O' consecutive in a row or column, so it is a draw.

In the third test case, we change only 3≤ ⌊ 12/3⌋ tokens, and the resulting grid is a draw.
```python

def disti(b,ind):

	a=[]
	for i in b:
		h=[]
		for j in i: h.append(j)
		a.append(h)
	ans=0

	id=0

	for i in range(n):
		start = ind[id%3]
		id+=1
		for j in range(start ,n,3):

			left=''
			right=''
			up=''
			down=''
			mid1=''
			mid2=''

			if(j-2 >= 0): left = a[i][j-2] + a[i][j-1] + a[i][j]
			if(j+2 <n ): right = a[i][j+2] + a[i][j+1] + a[i][j]
			if(i+2 <n ): down = a[i+2][j] + a[i+1][j] + a[i][j]
			if(i-2 >= 0 ): up = a[i-2][j] + a[i-1][j] + a[i][j]
			if(i+1<n and i-1>=0) : mid1 = a[i-1][j] + a[i][j] + a[i+1][j]
			if(j+1<n and j-1>=0) : mid2 = a[i][j-1] + a[i][j] + a[i][j+1]

			

			ok=False
			for k in (left,right,up,down,mid1,mid2):
				if(k=='XXX' or k=='OOO'): ok=True

			# ok=True

			if(ok and a[i][j] == 'X') : 
				a[i][j] = 'O'
				ans+=1
			# elif(ok and a[i][j] == 'O') : a[i][j] = 'X'
	return a,ans

def P(b):
	for i in b: print(*i,sep="")

for _ in range(int(input())):

	n=int(input())
	a=[]
	tot=0
	for i in range(n):
		s=list(input())
		a.append(s)
		tot+= (n-s.count('.'))

	
	b1,s1 = disti(a,[1,0,2])
	b2,s2 = disti(a,[2,1,0])
	b3,s3 = disti(a,[0,2,1])
	
	if(s1*3 <=tot) : P(b1)
	elif(s2*3 <=tot) : P(b2)
	elif(s3*3 <=tot) : P(b3)
	# print(s1,s2,s3)

```