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<iostream>
using namespace std;
const int MAXN=10;
int map[MAXN][MAXN],jilu[100][MAXN][MAXN];
int lie[10],zuoxie[20],youxie[20];
int v[100],q[100];
int tot=0;
void wwq(){
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++) jilu[tot][i][j]=map[i][j];
	}
	tot++;
}
void dfs(int i){
	for(int j=0;j<8;j++){
		if(lie[j]==0 && zuoxie[i+j]==0 && youxie[i-j+7]==0){
			lie[j]=1;
			zuoxie[i+j]=1;
			youxie[i-j+7]=1;
			map[i][j]=1;
			if(i==7) wwq();
			else dfs(i+1);
			lie[j]=0;
			zuoxie[i+j]=0;
			youxie[i-j+7]=0;
			map[i][j]=0;
		}
	}
} 
int main(){
	dfs(0);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>v[i]>>q[i];
	for(int i=0;i<92;i++){
		for(int i1=1;i1<=n;i1++){
			if(jilu[i][v[i1]][q[i1]]!=1) break;
			if(i1==n){
				for(int j=0;j<8;j++){
					for(int k=0;k<8;k++){
						if(jilu[i][j][k]==0) cout<<".";
						if(jilu[i][j][k]==1) cout<<"Q";
					}
					cout<<endl;
				}
			}
		}
	}
	return 0;
}