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.*;
import java.util.*;

public class Main {
	
	static final int[] queens = new int[8];
	static final boolean[] threatend = new boolean[8];
	
	public static void main(String[] Args) throws IOException {
		final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(br.readLine());
		for (int i = 0; i < n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine(), " ");
			int r = Integer.parseInt(st.nextToken());
			int c = Integer.parseInt(st.nextToken());
			queens[r] = c;
			threatend[r] = true;
		}
		check(0);
		final char[] output = new char[72];
		Arrays.fill(output,'.');
		for (int i = 8; i < 72; i+=9) {
			output[i] = '\n';
		}
		for (int i = 0; i < 8; i++) {
			output[i*9+queens[i]] = 'Q';
		}
		System.out.print(output);
	}
	
	private static boolean check(int r){
		if (r>=8) return true;
		if(threatend[r]) return available(r, queens[r]) && check(r+1);
		for (int i = 0; i < 8; i++) {
			queens[r] = i;
			if(available(r,i) && check(r+1)) return true;
		}
		return false;
	}
	
	private static boolean available(int r, int c){
		for (int i = 0; i < 8; i++) {
			if(i<r||(i>r && threatend[i])){
				if(c == queens[i]) return false;
				if(Math.abs(c-queens[i]) == Math.abs(r-i)) return false;
			}
		}
		return true;
	}
}
