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(input())
a = []
b = []
c = []
for i in range(N):
    a += [list(map(int, input().split()))]
    
row = [1]*9
col = [1]*9
dops = [1]*16
dneg = [1]*16

def sett(x, y):
    row[y] = 0
    col[x] = 0
    dops[x+y] = 0
    dneg[y-x+7] = 0

def dsett(x, y):
    row[y] = 1
    col[x] = 1
    dops[x+y] = 1
    dneg[y-x+7] = 1
    
def paint(ans):
    pain = [["."]*8for _ in range(8)]
    for i, j in ans.items():
        pain[i][j] = "Q"
        print("".join(pain[i]))
    
cnt = 1
def serch(h):
    global cnt
    if h == 8:
        aa = 0
        for i, j in a:
            if ans[i] == j:
                aa += 1
        if aa == len(a):
            cnt = 0
            paint(ans)
            return
    for i in range(8):
        if row[h] and col[i] and dops[h+i] and dneg[h-i+7] and cnt:
            sett(i, h)
            ans[h] = i
            
            serch(h+1)
            
            dsett(i, h)
            del ans[h]

ans = {}          
serch(0) 

    
    
