Problem:
Score : 900 points

Problem Statement

Let us consider a grid of squares with N rows and N columns. You want to put some domino pieces on this grid.
Each domino piece covers two squares that have a common side. Each square can be covered by at most one piece.

For each row of the grid, let's define its quality as the number of domino pieces that cover at least one square in this row.
We define the quality of each column similarly.

Find a way to put at least one domino piece on the grid so that the quality of every row is equal to the quality of every column,
or determine that such a placement doesn't exist.

Constraints

2 \le N \le 1000

Input

Input is given from Standard Input in the following format:

N

Output

If the required domino placement doesn't exist, print a single integer -1.

Otherwise, output your placement as N strings of N characters each.
If a square is not covered, the corresponding character must be . (a dot).
Otherwise, it must contain a lowercase English letter.
Squares covered by the same domino piece must contain the same letter.
If two squares have a common side but belong to different pieces, they must contain different letters.

Sample Input 1

6

Sample Output 1

aabb..
b..zz.
ba....
.a..aa
..a..b
..a..b

The quality of every row and every column is 2.

Sample Input 2

2

Sample Output 2

-1

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#define _USE_MATH_DEFINES
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
//#include <bits/stdc++.h>

#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <fstream>
#include <array>
#include <string>
#include <cstring>
#include <functional>
#include <ctime>
#include <iostream>
#include <unordered_set>
#include <complex>

#include <nmmintrin.h>
#include <mmintrin.h>
#include <emmintrin.h>


using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
//#define printe(...) void();
#define printE(...) fprintf(stderr, __VA_ARGS__);
//#define printE(...) void();


#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,P) scanf("%d %d %d %d",&n,&m,&o,&P)
#define SINT5(n,m,o,P,q) scanf("%d %d %d %d %d",&n,&m,&o,&P,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


const int INF = 1'010'000'000; // 0x3C33'6080
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first
#define sc  second

long long bitCount(unsigned long long bits) {
#if _MSC_VER >= 1920 || __INTEL_COMPILER
	return _mm_popcnt_u64(bits);
#else
	return __builtin_popcountll(bits);
#endif 
}

char ret[1003][1003];

void solve(int n) {
	if (n == 2) { puts("-1"); return;}
	if (n == 5) { puts("-1"); return;}

	FILL0(ret);
	rep(i, n) rep(j, n) ret[i][j] = '.';

	rep(a, 1000) {
		if (3 * a > n) {
			//cout << n << " NG" << endl; exit(-1);
			rep(i, INF)rep(j,INF) rep(k, INF) puts("aaaaaaaaaaaaaaaaaaaaaaaaaa");
			break;
		}
		if ((n - 3 * a) % 4 != 0) continue;
		const int b = (n - 3 * a) / 4;

		rep(i, a) {
			int z = i * 3;
			ret[z + 0][z + 0] = 'a'; ret[z + 0][z + 1] = 'a'; ret[z + 0][z + 2] = 'b';
			ret[z + 1][z + 0] = 'd'; ret[z + 1][z + 1] = '.'; ret[z + 1][z + 2] = 'b';
			ret[z + 2][z + 0] = 'd'; ret[z + 2][z + 1] = 'c'; ret[z + 2][z + 2] = 'c';
		}
		rep(i, b) {
			int z = a * 3 + i * 4;
			ret[z + 0][z + 0] = 'a'; ret[z + 0][z + 1] = 'a'; ret[z + 0][z + 2] = 'c'; ret[z + 0][z + 3] = 'd';
			ret[z + 1][z + 0] = 'b'; ret[z + 1][z + 1] = 'b'; ret[z + 1][z + 2] = 'c'; ret[z + 1][z + 3] = 'd';
			ret[z + 2][z + 0] = 'g'; ret[z + 2][z + 1] = 'h'; ret[z + 2][z + 2] = 'e'; ret[z + 2][z + 3] = 'e';
			ret[z + 3][z + 0] = 'g'; ret[z + 3][z + 1] = 'h'; ret[z + 3][z + 2] = 'f'; ret[z + 3][z + 3] = 'f';
		}
		
		rep(i, n) {
			cout << ret[i] << endl;
		}
		
		//cout << n << " OK" << endl;
		return;
	}
}

int main() {
	int n;
	while (cin >> n) {
		solve(n);
	}
}