The goal of 8 Queens Problem is to put eight queens on a chess-board such that none of them threatens any of others. A queen threatens the squares in the same row, in the same column, or on the same diagonals as shown in the following figure.

<image>


For a given chess board where $k$ queens are already placed, find the solution of the 8 queens problem.

Constraints

* There is exactly one solution

Input

In the first line, an integer $k$ is given. In the following $k$ lines, each square where a queen is already placed is given by two integers $r$ and $c$. $r$ and $c$ respectively denotes the row number and the column number. The row/column numbers start with 0.

Output

Print a $8 \times 8$ chess board by strings where a square with a queen is represented by 'Q' and an empty square is represented by '.'.

Example

Input

2
2 2
5 3


Output

......Q.
Q.......
..Q.....
.......Q
.....Q..
...Q....
.Q......
....Q...
board = [['#']*8 for i in range(8)]
n = int(input())
v1=[0]*8
v2=[0]*8
v3=[0]*16
v4=[0]*16


def dot(y,x):
    for j in range(8):
        board[y][j]='.'
        board[j][x]='.'
    for i in range(1,min(x,y)+1):
        board[y-i][x-i]='.'
    for i in range(1,min(7-x,y)+1):
        board[y-i][x+i]='.'
    for i in range(1,min(x,7-y)+1):
        board[y+i][x-i]='.'
    for i in range(1,min(7-x,7-y)+1):
        board[y+i][x+i]='.'
    board[y][x]='Q'
st=set()
ans=[]

def dfs(now,k,stock):
    if now == 8:
        ans.append(list(stock))
        return stock
    if not li[now]:
        dfs(now+1,k,stock)
    for i in li[now]:
        x,y1,y2=i
        if v2[x]==0 and v3[y1+7]==0 and v4[y2]==0:
            stock.add((now,x))
            v2[x]=1
            v3[y1+7]=1
            v4[y2]=1
            dfs(now+1,k,stock)
            v2[x]=0
            v3[y1+7]=0
            v4[y2]=0
            stock.remove((now,x))

for i in range(n):
    y , x = map(int, input().split())
    dot(y,x)
    v1[y]=1
    v2[x]=1
    v3[y-x+7]=1
    v4[y+x]=1

li=[[]for i in range(8)]
for i in range(8):
    for j in range(8):
        if board[i][j]=='#':
            li[i].append((j,i-j,j+i))

dfs(0,2,st)

for i in ans[0]:
    y,x=i
    dot(y,x)

for i in board:
    print(''.join(i))

