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 main():
    from copy import deepcopy
    from itertools import permutations
    import sys
    input=sys.stdin.readline

    k=int(input())
    stage=[[0]*8 for _ in range(8)]
    ans=[['.']*8 for _ in range(8)]
    ablex=[0,1,2,3,4,5,6,7]
    abley=[0,1,2,3,4,5,6,7]

    def q(x,y,stage):
        i,j=x,y
        while i>=0 and j>=0:
            stage[i][j]=1
            i-=1
            j-=1
        i,j=x,y
        while i<8 and j<8:
            stage[i][j]=1
            i+=1
            j+=1
        i,j=x,y
        while i>=0 and j<8:
            stage[i][j]=1
            i-=1
            j+=1
        i,j=x,y
        while i<8 and j>=0:
            stage[i][j]=1
            i+=1
            j-=1
        
    for i in range(k):
        x,y=map(int,input().split())
        q(x,y,stage)
        ans[x][y]='Q'
        ablex.remove(x)
        abley.remove(y)
    
    for ptr in permutations(abley):
        s=deepcopy(stage)
        flag=True
        for x,y in zip(ablex,ptr):
            if s[x][y]==1:
                flag=False
                break
            else:
                q(x,y,s)
        if flag:
            for x,y in zip(ablex,ptr):
                ans[x][y]='Q'
            for i in range(8):
                print(''.join(ans[i]))
            exit()
    
if __name__=='__main__':
    main()
