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>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
char board[10][10];
bool s[10], b[10], n1[20], n2[20];
bool f(int i, int j, int p) {
	if (p == 8) {
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				cout << board[i][j];
			}cout << endl;
		}
		return 1;
	}
	if (i >= 8)return 0;
	if (j >= 8)return f(i + 1, 0, p);
	bool b00l = 1;
	if (s[i])b00l = 0;
	if (b[j])b00l = 0;
	if (n1[i + j])b00l = 0;
	if (n2[i - j + 7])b00l = 0;
	if (!b00l)return f(i, j + 1, p);
	else {
		s[i] = 1; b[j] = 1; n1[i + j] = 1; n2[i - j + 7] = 1;
		board[i][j] = 'Q';
		if (f(i, j + 1, p + 1))return 1;
		s[i] = 0; b[j] = 0; n1[i + j] = 0; n2[i - j + 7] = 0;
		board[i][j] = '.';
		return f(i, j + 1, p);
	}
}
signed main() {
	for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++)board[i][j] = '.';
	bool b00l = 1;
	int n; cin >> n;
	for (int p = 0; p < n; p++) {
		int i, j; cin >> i >> j;
		board[i][j] = 'Q';
		if (s[i])b00l = 0; s[i] = 1;
		if (b[j])b00l = 0; b[j] = 1;
		if (n1[i + j])b00l = 0; n1[i + j] = 1;
		if (n2[i - j + 7])b00l = 0; n2[i - j + 7] = 1;
	}
	if (!b00l) { cout << "No Answer\n"; return 0; }
	b00l = f(0, 0, n);
	if (!b00l) { cout << "No Answer\n"; return 0; }
}
