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...
n = int(raw_input())
N = 8
data = [['.' for i in range(N)] for j in range(N)]
row = [0 for i in range(N)]
col = [0 for i in range(N)]
dpos = [0 for i in range(2*N-1)]
dneg = [0 for i in range(2*N-1)]
for i in range(n):
    tmp = map(int, raw_input().split())
    data[tmp[0]][tmp[1]] = 'Q'
    row[tmp[0]] = 1; col[tmp[1]] = 1
    dpos[tmp[0]+tmp[1]] = 1
    dneg[tmp[0]-tmp[1]+N-1] = 1
    
def printBoard(dt):
    for i in range(N):
        print ''.join(map(str, dt[i]))
        
def recursive(i, r, l, pos, neg, dt):
    if i == N:
        printBoard(dt)
        return
    if r[i] == 1:
        recursive(i+1, r, l, pos, neg, dt)
        return
    for j in range(N):
        if l[j] == 1 or pos[i+j] == 1 or neg[i-j+N-1] == 1:
            continue
        r[i] = 1; l[j] = 1
        pos[i+j] = 1; neg[i-j+N-1] = 1; dt[i][j] = 'Q'
        recursive(i+1, r, l, pos, neg, dt)
        r[i] = 0;l[j] = 0
        pos[i+j] = 0; neg[i-j+N-1] = 0; dt[i][j] = '.'
recursive(0, row, col, dpos, dneg, data)