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...
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;
#define rep(i,n) for(UL i=0; i<(n); i++)

UL buf[9][8][8]={};
UL mask[9]={};
UL ans[8][8];

void put(int x, int y, int k){
 buf[k][x][y]=2;
 for(int xx=0; xx<8; xx++) for(int yy=0; yy<8; yy++){
  if(buf[k][xx][yy]) continue;
  if(xx==x || yy==y || (x+y)==(xx+yy) || (x-y)==(xx-yy))
   buf[k][xx][yy]=1;
 }
}

bool proc(UL k){
 if(k==8){ rep(x,8)rep(y,8) ans[x][y]=buf[8][x][y]; return true; }
 UL y=0; rep(i,8) if(~mask[k] & (1<<i)) y=i;
 mask[k+1] = mask[k] | (1<<y);
 rep(x,8){
  rep(xx,8)rep(yy,8) buf[k+1][xx][yy]=buf[k][xx][yy];
  if(buf[k+1][x][y]) continue;
  put(x,y,k+1);
  if(proc(k+1)) return true;
 }
 return false;
}

int main() {
 mask[0]=0;
 UL K; scanf("%u",&K);
 rep(i,K){
  UL x,y; scanf("%u%u",&y,&x);
  mask[K] |= (1<<y);
  put(x,y,K);
 }
 proc(K);
 rep(y,8){
  rep(x,8) printf((ans[x][y]==2)?"Q":".");
  printf("\n");
 }
 return 0;
}

