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...
import itertools 
k = int(input())

#すでにクイーンがある位置
#[-1, -1, 2, -1, -1, 3, -1, -1]なら(2, 2)と(5, 3)にあることを示す
xy = [-1] * 8
for i in range(k):
  y, x = list(map(int, input().split()))
  xy[y] = x
#print(xy)

#どの列にあるか全て試す順列全探索
lis = [x for x in range(8)] # 0から7までのリスト 
permutations_lis = itertools.permutations(lis)# 全ての場合のリストを生成
# 以下出力
asn = [-1] * 8
for one_case in permutations_lis: 
  wrong = 0
  #print(one_case)
  for i in range(8):
    if (xy[i] != -1) and (xy[i] != one_case[i]):
      #すでにあるクイーンの位置に反してないか
      wrong = 1
      break
    for j in range(i + 1, 8):#下の行と被りがあるか
      #縦と斜め2方向で合計3方向
      if one_case[i] == one_case[j]:
        wrong = 1
      elif abs(one_case[i] - one_case[j]) == abs(i - j):
        wrong = 1
  if wrong == 0:
    ans = one_case
    
#print(ans)    
for i in range(8):
  for j in range(8):
    if ans[i] == j:
      print("Q", end = "")
    else:
      print(".", end = "")
  print("")

    
    
    
  
  
    
    

