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>
#define MAXN 128
using namespace std;
int xie1[MAXN],xie2[MAXN],lie[MAXN],hang[MAXN];
bool map[MAXN][MAXN];
int n;
int x,y;
void dfs(int i){
	int j,k;
	if (i == 8) {
		for (j = 0;j < 8;++j){
			for (k = 0;k < 8;++k){
				if (map[j][k]) cout<<"Q";
				else cout<<".";
			}
			cout<<"\n";
		}
		return;
	}
	if (hang[i]) dfs(i+1);
	else {
		for (j = 0;j < 8;++j){
			if (!lie[j] && !xie1[i+j] && !xie2[16-j+i]){
				lie[j]=1;
				xie1[i+j]=1;
				xie2[16-j+i]=1;
				map[i][j]=1;
				dfs(i+1);
				lie[j]=0;
				map[i][j]=0;
				xie1[i+j]=0;
				xie2[16-j+i]=0;
			}
		}
	}
}
int main(){
	int i;
	cin>>n;
	for (i = 0;i < n;++i){
		cin>>x>>y;
		lie[y]=1;
		hang[x]=1;
		map[x][y]=1;
		xie1[x+y]=1;
		xie2[16-y+x]=1;
	}
	dfs(0);
	return 0;
}