#include<iostream>

bool rc(int);
bool board[64]{}, row[8]{}, column[8]{}, right_down[15]{}, left_down[15]{};

int main()
{
	int k, r, c;

	std::cin >> k;
	for (int i = 0; i < k; ++i)
	{
		std::cin >> r >> c;
		board[r * 8 + c] = true;
		row[r] = column[c] = true;
		right_down[7 + c - r] = left_down[r + c] = true;
	}

	rc(k);
	for (int i = 0; i < 64; ++i)
	{
		if (board[i])
			std::cout << 'Q';
		else
			std::cout << '.';
		if (i % 8 == 7)
			std::cout << std::endl;
	}

	return 0;
}

bool rc(int k)
{
	if (k == 8)
		return true;

	for (int i = 0; i < 8; ++i)
	{
		if (row[i]) continue;
		row[i] = true;
		for (int j = 0; j < 8; ++j)
		{
			if (column[j] || right_down[7 + j - i] || left_down[i + j])
				continue;
			column[j] = right_down[7 + j - i] = left_down[i + j] = true;
			board[i * 8 + j] = true;

			if (rc(k + 1))
				return true;

			column[j] = right_down[7 + j - i] = left_down[i + j] = false;
			board[i * 8 + j] = false;
		}
		row[i] = false;
		return false;
	}
}

// ※※※ 解答不能 ※※※
// Um_nik氏
// https://atcoder.jp/contests/agc041/submissions/9181788
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const int N = 1010;
int n;
char s[N][N];
char a[4][5] = {
    "aabc",
    "ddbc",
    "efgg",
    "efhh"
};
char b[5][6] = {
    "aabbc",
    "dee.c",
    "d..fg",
    "h..fg",
    "hiijj"
};
char c[7][8] = {
    "aabbc..",
    "d...cee",
    "dffgg..",
    "hh...ij",
    "..k..ij",
    "..k..lm",
    "...nnlm"
};

void solve(vector<int> w){
    int p = 0;
    for(int x : w){
        if(x == 4)      rep(i, x) rep(j, x) s[p + i][p + j] = a[i][j];
        else if(x == 5) rep(i, x) rep(j, x) s[p + i][p + j] = b[i][j];
        else if(x == 7) rep(i, x) rep(j, x) s[p + i][p + j] = c[i][j];
        p += x;
    }
}

int main(){
    scanf("%d", &n);
    if(n == 2){
        printf("-1\n");
        return 0;
    }
    rep(i, n) rep(j, n) s[i][j] = '.';
    if(n % 3 == 0){
        repex(i, 0, n, 3) s[i][i] = s[i][i + 1] = s[i + 1][i + 2] = s[i + 2][i + 2] = 'a';
    }else{
        if(n == 7){
            solve({7});
        }else if (n == 11){
            solve({4, 7});
        }else{
            vector<int> w;
            int x = n;
            while(x % 4 != 0){
                w.push_back(5);
                x -= 5;
            }
            if(x < 0) throw;
            while(x > 0){
                w.push_back(4);
                x -= 4;
            }
            solve(w);
        }
    }
    rep(i, n){
        s[i][n] = '\0';
        printf("%s\n", s[i]);
    }
    return 0;
}