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...
import sys;

def putQueen(i, row, col, dpos, dneq):
    global finding
    if(finding == 0):
        return
        
    if(i == 8):
        finding = 0
        printBoard(row[0:])
        return
    

    for j in range(8):
        if i in myset:
            putQueen(i+1,row[0:], col[0:], dpos[0:], dneq[0:])
            continue
        if(col[j] == 1 or dpos[i+j] == 1 or dneq[i-j+7] == 1):
            continue
        row[i] = j
        col[j] = dpos[i+j] = dneq[i-j+7] = 1
        putQueen(i+1,row[0:], col[0:], dpos[0:], dneq[0:])
        col[j] = dpos[i+j] = dneq[i-j+7] = 0

def printBoard(row):
    for k in range(8):
        if(row[k] == 0):
            print("Q.......")
        elif(row[k] == 1):
            print(".Q......")
        elif(row[k] == 2):
            print("..Q.....")
        elif(row[k] == 3):
            print("...Q....")
        elif(row[k] == 4):
            print("....Q...")
        elif(row[k] == 5):
            print(".....Q..")
        elif(row[k] == 6):
            print("......Q.")
        else:
            print(".......Q")

n = (int)(input());
row = [0 for i in range(8)]
col = [0 for i in range(8)]
dpos = [0 for i in range(15)]
dneq = [0 for i in range(15)]

myset = set()

for i in range(n):
    r,c = map(int, input().split());
    myset.add(r)
    row[r] = c
    col[c] = 1
    dpos[r+c] = 1
    dneq[r-c+7] = 1

finding = 1

putQueen(0,row, col, dpos, dneq)

