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...
from itertools import permutations
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    k,*rc = map(int, read().split())

    tmp = []
    ng_list_add = []
    ng_list_sub = []
    for pattern in permutations(range(8)):
        flag = True
        for r, c in enumerate(pattern):
            if r + c in ng_list_add or r - c in ng_list_sub:
                flag = False
                break
            ng_list_add.append(r+c)
            ng_list_sub.append(r-c)
        if flag:
            tmp.append(pattern)
        ng_list_add = []
        ng_list_sub = []
    
    RC = []
    for r, c in zip(*[iter(rc)]*2):
        RC.append((r, c))

    ans_place = None
    for p in tmp:
        flag = True
        for r, c in RC:
            if p[r] != c:
                flag = False
                break
        if flag:
            ans_place = p
            break

    ans = []
    for i in ans_place:
        line = "." * i + "Q" + "." * (7-i)
        ans.append(line)

    print("\n".join(ans))


if __name__ == "__main__":
    main()
