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>
#define int long long
#define H 8
#define W 8
using namespace std;
const int INF = 1LL<<55;
int Max(int &a,int b){return a=max(a,b);}
int Min(int &a,int b){return a=min(a,b);}

int mp[H][W],used[W];

bool check(int sy,int sx){
  if(used[sx]) return 0;
  int dx[] ={1,-1,1,-1};
  int dy[] ={1,-1,-1,1};
  int res = 1;
  for(int i=0;i<4;i++){
    int x = sx,y = sy;
    while(x>=0 && y>=0 && x<W && y<H){
      res &= mp[y][x] == 0;
      x += dx[i];
      y += dy[i];
    }

  }
  return res;
}

void dfs(int y){
  if(y == H){
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++)cout<< (mp[i][j]? 'Q':'.');
      cout<<endl;
    }
    exit(0);
    return;
  }

  for(int i=0;i<W;i++)if(mp[y][i] == 1){ dfs(y+1);return;}
  for(int i=0;i<W;i++){
    if(!check(y,i))continue;
    used[i] = mp[y][i] = 1;
    dfs(y+1);
    mp[y][i] =  used[i] = 0;
  }
}

signed main(){
  int n;
  cin>>n;
  for(int i=0,y,x;i<n;i++){
    cin>>y>>x;
    mp[y][x] = 1;
    used[x] = 1;
  }
  dfs(0);
  
  return 0;
}