#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

ll mp[555][555];
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};
vector<ll> v;

ll gcd(ll a,ll b){
	if(a < b)swap(a,b);
	return b == 0 ? a : gcd(b,a%b);
}

void prime(){
	vector<bool> pri(100000);
	vector<ll> tmp;
	int cou = 0;
	for(int i = 2;;i++){
		if(!pri[i]){
			tmp.PB(i);
			for(int j = i;j < 100000;j+=i)pri[j] = true;
			cou++;
		}
		if(cou == 1010)break;
	}
	for(int i = 0,j = tmp.size() - 1;i < j;i++,j--){
		v.PB(tmp[i]);
		v.PB(tmp[j]);
	}
}

void seica(){
	REP(i,555)REP(j,555)mp[i][j] = 1;
	REP(i,500){
		REP(j,500){
			if((i+j) % 2 == 0){
				mp[i][j] *= v[(i+j)/2];
			}
			if((i+499-j) % 2 == 1){
				mp[i][j] *= v[501+(i+499-j)/2];
			}
		}
	}

	REP(i,500){
		REP(j,500){
			if((i + j) % 2){
				ll now = 1;
				REP(k,4){
					if(i+dy[k] >= 0 && i+dy[k] < 500 && j+dx[k] >= 0 && j+dx[k] < 500){
						ll hoge = gcd(now, mp[i+dy[k]][j+dx[k]]);
						now *= mp[i+dy[k]][j+dx[k]] / hoge;
					}
				}
				mp[i][j] = now + 1;
			}
		}
	}
}

int main(){

	int n;cin >> n;

	prime();
	//cout << v.size() << endl;
	seica();

	REP(i,n){
		REP(j,n){
			cout << mp[i][j] << " ";
		}
		cout << endl;
	}

	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(ll i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll,ll> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n <= 2) {
        cout << "-1\n";
    } else if (n % 3 == 0) {
        rep (i, n) {
            rep (j, n) {
                if (i / 3 == j / 3 && ((i % 3 == 0) ^ (j % 3 == 0))) cout << 'a';
                else cout << '.';
            }
            cout << "\n";
        }
    } else if (n == 7) {
        cout << "abb...a\n"
             << "a.a...a\n"
             << "bba...c\n"
             << "...abbc\n"
             << "...a.ab\n"
             << "...bbab\n"
             << "bbaacc.\n";
    } else if (n == 11) {
        cout << "bccaabbccaa\n"
             << "babb...abbc\n"
             << "ca.a...a.ac\n"
             << "cbba...bbab\n"
             << "baccbcc...b\n"
             << "ba.ab.b...a\n"
             << "accaccb...a\n"
             << "a...baacaab\n"
             << "b...b.bc.cb\n"
             << "b...aabaaca\n"
             << "ccaabbccbba\n";
    } else {
        int a, b;
        for (int i = n / 5; i >= 0; i--) {
            if ((n - 5 * i) % 4 == 0) {
                a = i;
                b = (n - 5 * i) / 4;
                break;
            } 
        }
        // eprintf("a=%d, b=%d\n", a, b);
        vector<string> s4 = {"aaca", "bbca", "acbb", "acaa"},
                       s5 = {"aacca", "c.bba", "cb..c", "ab..c", "accaa"};
        rep (i, n) {
            rep (j, n) {
                if (i / 5 == j / 5 && i / 5 < a) {
                    // cout << 1;
                    cout << s5[i % 5][j % 5];
                } else if ((i - 5 * a) / 4 == (j - 5 * a) / 4 && i - 5 * a >= 0 && j - 5 * a >= 0) {
                    // cout << 2;
                    cout << s4[(i - 5 * a) % 4][(j - 5 * a) % 4];
                } else {
                    // cout << 3;
                    cout << '.';
                }
            }
            cout << "\n";
        }
    }
    return 0;
}