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...
def check(a):
    flag = True
    for i in C:
        if (i[0] == a[0]) or (i[1] == a[1]) or (abs(i[0]-a[0]) == abs(i[1]-a[1])):
            flag = False
    return flag

def recq(r):
    if r == 8:
        pass
    elif DPr[r] == 1:
        recq(r+1)
    else:
        for c in range(8):
            if DPc[c]:
                continue
            else:
                if check((r,c)):
                    DPr[r] = 1
                    DPc[c] = 1
                    C.append([r,c])
                    recq(r+1)
                    flag = False
                    for i in range(8):
                        if DPr[i]==0:
                            flag = True
                    if flag:
                        C.pop()
                        DPr[r] = 0
                        DPc[c] = 0
k = int(input())
C = [[int(i) for i in input().split()] for _ in range(k)]
DPr = [0 for i in range(8)]
DPc = [0 for i in range(8)]
for i in C:
    DPr[i[0]]=1
    DPc[i[1]]=1
recq(0)
Q = [["." for i in range(8)] for i in range(8)]
for i in C:
    Q[i[0]][i[1]] = "Q"
for i in Q:
    tmp = ""
    for j in i:
        tmp+=j
    print(tmp)
