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 Thu May  7 22:24:11 2020

@author: Kanaru Sato
"""

import itertools
import copy

def setdanger(Map,r,c):
    Map[r][c] == 0
    for i in range(8):#縦横
        Map[r][i] = 0
        Map[i][c] = 0
    for i in range(max(r-7,-c),min(r,7-c)+1):#右上がり斜め
        Map[r-i][c+i] = 0
    for i in range(max(-c,-r),min(7-c,7-r)+1):#左上がり斜め
        Map[r+i][c+i] = 0

def dfs(i,Map,ans):#i個をmapに配置するやり方を深さ優先探索し、存在したら座標を追加、Trueを返す
    if i == 0:
        return True
    else:
        for pointtuple in itertools.product([i for i in range(8)], repeat=2):
            point = list(pointtuple)
            if Map[point[0]][point[1]]:
                currentMap = copy.deepcopy(Map)
                setdanger(currentMap,point[0],point[1])
                if dfs(i-1,currentMap,ans):
                    ans.append(point)
                    return True
                    break
    
k = int(input())

ans = []
for i in range(k):
    ans.append(list(map(int,input().split())))

Map = [[1 for i in range(8)] for j in range(8)]
for i in range(k):
    setdanger(Map,ans[i][0],ans[i][1])

dfs(8-k,Map,ans)

for i in range(8):
    row = []
    for j in range(8):
        if [i,j] in ans:
            row.append("Q")
        else:
            row.append(".")
    print("".join(row))

