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;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  int k;
  cin >> k;

  VI col(8,-1);
  REP(i,k){
    int r, c;
    cin>> r >> c;
    col[c] = r;
  }

  VI a = {0,1,2,3,4,5,6,7};
  VI ans;
  do {
    bool ok=true;
    set<int> st;
    REP(i,8){
      if(col[i] != -1 && col[i] != a[i])ok=false;
    }
    if(!ok)continue;

    ok=true;

    REP(i,8){
      FOR(j,i+1,8){
        if(abs(i - j) == abs(a[i] - a[j]))ok=false;
      }
    }

    if(ok){
      ans = a;
      break;
    }

  }while(next_permutation(ALL(a)));

  REP(i,8){
    REP(j,8){
      if(ans[j]==i)cout << "Q";
      else cout << ".";
    }
    cout << endl;
  }
}

