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 fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007
#define INF (1<<28)
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)

#define int long long
int defplace[8][8],ans[8][8],done;

bool checks(int m[8][8],int x,int y){
	lp(i,8){
		lp(j,8){
			if(m[i][j]==1){
				if(i==x&&j==y)continue;
				if(abs(x-i)==abs(y-j)) return false;
				if(x==i||y==j) return false;
			}
		}
	}
	return true;
}

void try8(int m[8][8],int x){
	/*lp(i,8){
		lp(j,8){
			if(m[i][j]==1) cout<<"Q";
			else cout<<".";
		}
		cout<<endl;
	}
	int hoge;
	cin>>hoge;*/
	if(x==8){
		lp(i,8)lp(j,8){
			ans[i][j]=m[i][j];
		}
		done=1;
		return;
	}
	if(done==1) return;
	lp(i,8){
		if(defplace[x][i]==1){
			if(checks(m,x,i)==false) return;
			else{
				m[x][i]=1;
				try8(m,x+1);
				m[x][i]=0;
				return;
			}
		}
	}
	lp(i,8){
		if(checks(m,x,i)==false) continue;
		m[x][i]=1;
		try8(m,x+1);
		m[x][i]=0;
	}
	return;
}

signed main(){
	int k;
	cin>>k;
	lp(i,k){
		int a,b;
		cin>>a>>b;
		defplace[a][b]=1;
	}
	int m[8][8];
	lp(i,8)lp(j,8)m[i][j]=0;
	try8(m,0);
	lp(i,8){
		lp(j,8){
			if(ans[i][j]==1) cout<<"Q";
			else cout<<".";
		}
		cout<<endl;
	}
	return 0;
}

