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())
# class Queen():
#     def __init__(self, x,y):
#         self.x =x
#         self.y = y
#         self.right = self.x + self.y
#         self.left = abs(self.x -self.y)
#
#
#
# queen_row = [False for _ in range(8)]
# queen_col = [False for _ in range(8)]
# ups = [False for _ in range(2 * 8 -1)]
# downs = [False for _ in range(2 * 8 -1)]
#
#
# for _ in range(N):
#     r,c = list(map(int,input().split()))
#     # queen_row.append(Queen(c,r))
#     queen_row[r] = c
#     queen_col[c] = True
#     ups[r+c] = True
#     downs[abs(r-c)] = True
#
# # queen_list = [Queen(c,r) in r,c range() ]
# def is_not_cross(q1:Queen,q2:Queen):
#     if q1.left != q2.left and q1.right != q2.right:
#         return True
#     else:
#         return False
#
#
# # def put_queen(queen_list:list):
# #     x_set = {i for i in range(8)} - {q.x for q in queen_list}
# #     y_set = {i for i in range(8)} - { q.y for q in queen_list}
# #     for i,x in enumerate(x_set):
# #         for y in y_set:
# #             q1 = Queen(x,y)
# #             for q2 in queen_list:
# #                 if is_not_cross(q1,q2):
# #                     queen_list.append(q1)
# #         print(i)
# #
# #     return queen_list
#
#
#     # return queen_list
#
#
# def put_queen(rows,col_no=0):
#     # search_rows = [ i  for i in range(8) ]
#     search_rows = [ i  for i, is_exist in zip(range(8), rows) if not is_exist ]
#     # print(search_rows)
#     # print(col_no)
#     for n in search_rows:
#         print({"queen_col": queen_col, "rows": rows, })
#
#         if not queen_col[col_no] and not ups[n + col_no] and not downs[abs(n- col_no)]:
#             print(f" success :row_no:{n},col_no:{col_no}")
#
#             queen_col[col_no] =True
#             ups[n + col_no] = True
#             downs[abs(n- col_no)] = True
#             rows[n] = col_no
#
#             if col_no + 1 >=N:
#                 print(f"終了 {queen_col}")
#                 # print(search_rows)
#
#                 return rows # 全探索終了
#             else:
#                 res = put_queen(rows,col_no + 1)
#                 print(f"row_no:{n},col_no:{col_no}")
#                 print(res)
#                 if res:
#                     return res
#                 else:
#                     rows[n] = False
#                     ups[n + col_no] = False
#                     downs[abs(n - col_no)] = False
#                     queen_col[col_no] = False
#                     rows = put_queen(rows,queen_col,ups,downs,col_no + 1)
#     return False
#
#
# def print_queen(rows):
#     board = [["." for _ in range(8)] for _ in range(8)]
#     for row,col in enumerate(rows):
#         board[row][col] = "Q"
#     for b_y in board:
#         for i, b in enumerate(b_y):
#             print(b, end="")
#             if i == 7:
#                 print("\n")
# queen_list = put_queen(queen_row,0)
# print(queen_list)
# print_queen(queen_list)
#
# def is_able_put(rows):
#     for row,col in
#
#
# def put_queen(rows,n=0,DEFAULT_ROW=queen_row):
#     search_rows = [i for i, is_exist in zip(range(8), rows) if not is_exist]
#     # 歯抜けになっている順列を生成(ついでに、斜め判定も行う)
#
#     if is_able_put():
#
#
#     if n ==/
#
# # class
#

N = int(input())
DEFAULT_TABLE = [False for _ in range(8)]
DEFAULT_UPS = [False for _ in range(15)]
DEFAULT_DOWNS = [False for _ in range(15)]
for i in range(N):
    r,c = list(map(int,input().split()))
    DEFAULT_TABLE[r] = c
    DEFAULT_DOWNS[r-c + 7] = True
    DEFAULT_UPS[r + c] = True


def exclude(data, idx):
    return [x for i, x in enumerate(data) if i not in idx]


def permutationListRecursive(data, r, progress):
    # r = r if r > 0 else len(data) - len(exclued)

    if r == 0:
        # result.append(progress)
        table = DEFAULT_TABLE.copy()
        ups  =DEFAULT_UPS.copy()
        downs = DEFAULT_DOWNS.copy()

        for i,t in enumerate(table):
            if t is False:
                col = progress.pop()
                # print(table,progress, col)

                if ups[i+ col] or downs[i- col + 7]:
                    return False
                table[i]=col
                ups[i+col ] = True
                downs[i-col + 7] = True
            else:
                continue
        # print(f"progressis {progress}, ups :{ups} downs:{downs} ,table is {table}")

        result = table
        return result
    for i in range(len(data)):
        # progress= progress + [data[i]]
        res = permutationListRecursive(exclude(data, [i]), r - 1, progress + [data[i]])
        if res:
            return res
data =list(range(8))

for x in DEFAULT_TABLE:
    if x is not False:
        data.remove(x)
res_table= permutationListRecursive(data,len(data),[])
# print(res_table)
for i in range(8):
    for j in range(8):
        if res_table[i] == j:
            print("Q",end="")
        else:
            print(".",end="")
    print()

