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 REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

int main(){
  int n;
  cin >> n;
  int place[8];
  int fixed[8];
  REP(i, 8){ place[i] = i; fixed[i]=-1; }
  REP(i, n) {
    int tx, ty;
    cin >> tx >> ty;
    fixed[tx] = ty;
  }
  do {
    bool valid = true;
    REP(i, 8) if(fixed[i] != -1 && fixed[i] != place[i]) { valid = false; break; }
    REP(i, 8) REP(j, i) if(abs(place[i]-place[j]) == i-j) { valid = false; break; }
    if(valid) break;
  } while(next_permutation(place, place+8));
  REP(i, 8) {
    REP(j, 8) cout << (place[i]==j ? "Q" : ".");
    cout << endl;
  }
  return 0;
}
