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<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int m[9][9];
int row[9],col[9],dp[18],ds[18];

bool sorv(int x){
    int i, j;
    if(x==9) return true;
    if(row[x]) return sorv(x+1);
    for(j = 1; j < 9; j++){
        if(!col[j] && !dp[x+j] && !ds[x-j+7]){
            row[x] = j;
            col[j] = x;
            dp[j+x] = ds[x-j+7] = 1;
            if(sorv(x+1)) return true;
            row[x] = 0;
            col[j] = 0;
            dp[j+x] = ds[x-j+7] = 0;
        }
    }
    return false;
}

int main(){
    int i, n, j, k;
    scanf("%d",&n);
    for(i = 0; i < n; i++){
        scanf("%d%d",&j,&k);
        j++;k++;	
        //m[j][k] = 1;
        row[j] = k;
        col[k] = j;
        dp[j+k] = ds[j-k+7] = 1;
    }
    for(i = 1; i < 9; i++){
        if(row[i]) continue;
        sorv(i);
        break;
    }
    for(i = 1; i < 9; i++){
        for(j = 1; j < 9; j++){
            if(row[i]==j) cout << 'Q';
            else cout << '.';
        }
        cout << endl;
    }
} 
