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...
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 13 18:17:29 2018
ALDS_1_13_A
@author: maezawa
"""
import copy
def searchq(board, k):
    global result
    if k == 0:
        result = copy.deepcopy(board)
        return True
    for x in range(1,9):
        for y in range(1,9):
            #if k == 6:
                #print(x,y,board[x][y])
            if board[x][y] == 0:
                cpb = copy.deepcopy(board)
                cpb[x][y] = 9
                mark(cpb, x,y)
                #print(x,y)
                if searchq(cpb, k-1):
                    return True
                #else:
                    #print('False at {},{}'.format(x,y))
    return False
      
def mark(board, x, y):
    direction = [(-1,-1), (-1,0), (-1,1), (0,-1), (0,1), (1,-1),
                 (1,0), (1,1)]
    for dx, dy in direction:
        x1 = x
        y1 = y
        while True:
            x1 += dx
            y1 += dy
            if board[x1][y1] == 0 or board[x1][y1] == 1:
                board[x1][y1] = 1
            else:
                break
            
n = int(input())
board = [[0]*10 for _ in range(10)]
board[0] = [-1]*10
board[9] = [-1]*10

result = copy.deepcopy(board)

for i in range(10):
    board[i][0] = -1
    board[i][9] = -1
for i in range(n):
    x, y = list(map(int, input().split()))
    board[x+1][y+1] = 9
    mark(board, x+1, y+1)

#print(*board[1:9], sep='\n')
if searchq(board, 8-n):
    pass
else:
    print('Error')
#print(*result[1:9], sep='\n')
for x in range(1,9):
    for y in range(1,9):
        if result[x][y] == 9:
            print('Q', end='')
        else:
            print('.', end='')
    print()


