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...
# 8 queens
import itertools


# x座標が全部異なる
# y座標が全部異なる
# 8C2でx座標の差分とy座標の差分が異なる
# 列挙して含まれるものを挙げる

def check(queens):
    for r1, c1 in queens:
        for r2, c2 in queens:
            # 同じ座標の時は気にしない
            if r1 == r2 and c1 == c2:
                continue
            if (r1 == r2) or (c1 == c2):
                return False
            if abs(r1 - r2) == abs(c1 - c2):
                return False
    return True


k = int(input())
queens = []
row, col = list(range(8)), list(range(8))
for _ in range(k):
    r, c = map(int, input().split())
    queens.append((r, c))
    row.remove(r)
    col.remove(c)

# colを順列化する
for l in itertools.permutations(col):
    tmp_queens = queens.copy()
    # rowは固定 どうせ全てにおかれる。
    for r, c in zip(row, l):
        tmp_queens.append((r, c))
    if check(tmp_queens):
        board = [''.join('Q' if (r, c) in tmp_queens else '.' for c in range(8)) for r in range(8)]
        print(*board, sep='\n')
        break
