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...
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static int time = 0;

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_6_A-in9.txt"));

		int k = scan.nextInt();
		HS hs = new HS();

		for (int i = 0; i < k; i++) {
			int r = scan.nextInt();
			int c = scan.nextInt();
			hs.add(i, r, c);
		}
		hs.solve();

		for (int r = 0; r < 8; r++) {
			for (int c = 0; c < 8; c++)
				if (hs.isQuenn(r, c))
					System.out.print("Q");
				else
					System.out.print(".");
			System.out.println();
		}

		scan.close();
		System.exit(0);
	}
}

class HS {

	int[] row;
	int[] col;

	public HS() {
		row = new int[8];
		col = new int[8];
		for (int i = 0; i < 8; i++) {
			row[i] = -1;
			col[i] = -1;
		}
	}

	public boolean isQuenn(int r, int c) {
		for (int k = 0; k < 8; k++)
			if (row[k] == r && col[k] == c)
				return true;
		return false;
	}

	public void solve() {
		int k = 0;
		for (; k < row.length; k++)
			if (row[k] == -1)
				break;
		sol(k);
	}

	private boolean sol(int k) {
		if (k == 8)
			return true;
		for (int r = 0; r < 8; r++)
			for (int c = 0; c < 8; c++)
				if (isAbl(r, c)) {
					row[k] = r;
					col[k] = c;
					if (sol(k + 1))
						return true;
					row[k] = -1;
					col[k] = -1;
				}
		return false;
	}

	private boolean isAbl(int r, int c) {
		for (int k = 0; k < 8; k++) {
			if (row[k] == -1)
				break;
			if (row[k] == r || col[k] == c || row[k] + col[k] == r + c || row[k] - col[k] == r - c)
				return false;
		}
		return true;
	}

	public void add(int i, int r, int c) {
		row[i] = r;
		col[i] = c;
	}
}