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, itertools
f = sys.stdin
        
n = int(f.readline())
q = []
rest_r = set(range(8))
rest_c = [i for i in range(8)]
for _ in range(n):
    r, c = map(int, f.readline().split())
    q.append([r, c, r + c, r - c])
    rest_r.remove(r)
    rest_c.remove(c)

def check(q, rc):
    for qi in q:
        if qi[2] == rc[2] or qi[3] == rc[3] :
            return False
    return True
    
def put_queen(q, rest_r, rest_c):
    if len(q) == 8:
        return q
    c = rest_c[len(rest_r) - 1]
    for r in rest_r:
        rc = [r, c, r + c, r - c]
        if check(q, rc):
            ret = put_queen(q + [rc], rest_r.difference([r]) , rest_c)
            if ret:
                return ret
    return False
q = put_queen(q, rest_r, rest_c)
    
board = [None for _ in range(8)]
for qi in q:
    board[qi[0]] = '.' * qi[1] + 'Q' + '.' * (8 - qi[1] - 1)
for line in board:
    print(line)