//Konrad Paluszek,University of Warsaw(former XIV LO Staszic)
//it's nice to stick a fork into an open socket
//clock says it's time to sleep
//our getppid() in heaven, hallowed by ttyname
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#define TIME (chrono::steady_clock::now().time_since_epoch().count())
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define xfm(a,b)a##b
#define xwb(a,b)xfm(a,b)
#define _ xwb(nvj,__LINE__)
#define FOR(i,b,e)for(urs((b)+(e))i=(b);i<=(e);++i)
#define REP(i,n)for(urs(n)i=0;i<(n);++i)
#define FORD(i,b,e)for(urs((b)+(e))i=(b);i>=(int)(e);--i)
#define UNTIL(t)while(clock()<(t)*CLOCKS_PER_SEC)
#define PER(r...)for(bool _=1;_||next_permutation(r);_=false)
#define ALL(r)(r).begin(),(r).end()
#define FS(r)r.first,r.second
#define sim template<class c
#define ros return o
#define rans return ans
#define forbits(i,m)if(m)for(urs(m)i=ctz(m),i##nvj=m;i##nvj;i##nvj^=((urs(m))1<<i),i=ctz(i##nvj))
#define fordbits(i,m)if(m)for(urs(m)i=8*sizeof(m)-clz(m)-1,i##nxd=m;i##nxd;i##nxd^=((urs(m))1<<i),i=8*sizeof(m)-clz(i##nxd)-1)
#define ksets(t, m, k, n) for (t m = (((t)1 << (k)) - 1); m < ((t)1 << (n)); m = nux(m))
#define urs(r...)typename decay<decltype(r)>::type
#define hur(f,g,r)sim>int f(c a){if(sizeof(c)==16)return r;if(sizeof(c)==8)return g##ll(a);return g(a);}
#define pwq(t,i) int clz(t x){return clz<int>(x)-i;}
using namespace __gnu_pbds;using namespace std;using ll=long long;using ld=long double;using ull=unsigned long long;using pii=pair<int,int>;using pll=pair<ll,ll>;using vpii=vector<pii>;using unt=unsigned int;sim>using min_queue=priority_queue<c,vector<c>,greater<c>>;sim>using ordered_set=tree<c,null_type,less<c>,rb_tree_tag,tree_order_statistics_node_update>;hur(popc,__builtin_popcount,popc<ull>(a)+popc<ull>(a>>64))hur(ctz,__builtin_ctz,(ull)a?ctz<ull>(a):64+ctz<ull>(a>>64))hur(clz,__builtin_clz,a>>64?clz<ull>(a>>64):64+clz<ull>(a))pwq(short,16)pwq(uint16_t,16)pwq(char,24)pwq(int8_t,24)pwq(uint8_t,24)sim,class N>bool mini(c&o,const N&h){if(o>h)ros=h,1;return 0;}sim,class N>bool maxi(c&o,const N&h){if(o<h)ros=h,1;return 0;}sim,class n>using gyv=c;
#ifdef LOCAL
#include </home/kjp/headers/debuglib.hpp>
#else
#define loc(...)
#define onl(r...)r
#define debug(...)
#define print_stack(...)
#define mark_stack(...)
#define set_pre(...)
#define reg_it(...)
#endif
#define next nexT
#define prev preV
#define tree trEE
#define left lefT
#define right righT
#define div diV
#define y1 y_1
ull mix(ull o){o+=0x9e3779b97f4a7c15;o=(o^(o>>30))*0xbf58476d1ce4e5b9;o=(o^(o>>27))*0x94d049bb133111eb;ros^(o>>31);}ull SALT=0x7a14a4b0881ebf9,tqu=0x7a14a4b0881ebf9;ull my_rand(){return tqu=mix(tqu);}void my_srand(ull x){SALT=tqu=x;}const int inf = 1023400000;const ll llinf=1234567890000000000ll;
#define rand my_rand
#define srand my_srand
#define random_shuffle(r...)random_shuffle(r,[](int _){return my_rand()%_;})
sim>inline c nux(c m){if(!m)return numeric_limits<c>::max();c A=m&-m;c B=~((A-1)^m);c C=B&-B;c D=(C>>(1+ctz(A)))-1;return C|(m&~(C-1))|D;}__attribute__((no_sanitize_undefined))ll mul(ll a,ll b,ll m){ll q=a*(ld)b/m;ll o=a*b-q*m;o%=m;if(o<0)o+=m;ros;}sim>void unq(c&x){x.resize(unique(ALL(x))-x.begin());}sim>c gcd(c o,c b){while(o&&b){int x=ctz(o),y=ctz(b);if(x>y)o>>=x-y;else b>>=y-x;if(o>b)o-=b;else b-=o;}ros?o:b;}sim>c lcm(c o,c b){ros/gcd(o,b)*b;}
sim>typename enable_if<is_integral<c>::value,ull>::type my_hash(c x){
	if(sizeof(c)>8) return mix((ull)x^SALT)^mix((ull)(x>>64)^SALT);
	return mix(x^SALT);
}
template<size_t N>ull my_hash(const bitset<N>&x){
	return mix(hash<bitset<N>>()(x)^SALT);
}
sim,class n>ull my_hash(const pair<c,n>&);
sim>gyv<ull,typename c::value_type>my_hash(const c&x){
	ull o=SALT;
	for(auto&d:x)o=mix(o^my_hash(d));
	ros;
}
sim,class n>ull my_hash(const pair<c,n>&x){return mix(my_hash(x.first))^my_hash(x.second);}
sim>struct my_hasher{size_t operator()(const c&o)const{return my_hash(o);}};
sim,class m>using _un0rDer3d_M4P=loc(unordered_map)onl(cc_hash_table)<c,m,my_hasher<c>>;
#define unordered_map _un0rDer3d_M4P
#if defined(LOCAL) || defined(LOCAL2)
void __tmi() {cerr << "total time: " << clock() / (ld)CLOCKS_PER_SEC << "s" << endl;}int _ = (atexit(__tmi), 0);
#endif
const int nax = 7;
int cov[nax * 2];
int is[nax * nax];
vector <pair <array<int, 2>, array<int, 3> > > blocks;
int n, k;
int nr(int x, int y) {
	return x * n + y;
}
int col(int x) {
	return x;
}
int row(int x) {
	return x + n;
}
int cou = 0;
char a[1010][1010];
void do4(int i, int j) {
	a[i + 3][j + 0] = a[i + 2][j + 0] = cou++ % 26 + 'a';
	a[i + 0][j + 1] = a[i + 0][j + 0] = cou++ % 26 + 'a';
	a[i + 1][j + 1] = a[i + 1][j + 0] = cou++ % 26 + 'a';
	a[i + 3][j + 1] = a[i + 2][j + 1] = cou++ % 26 + 'a';
	a[i + 1][j + 2] = a[i + 0][j + 2] = cou++ % 26 + 'a';
	a[i + 1][j + 3] = a[i + 0][j + 3] = cou++ % 26 + 'a';
	a[i + 2][j + 3] = a[i + 2][j + 2] = cou++ % 26 + 'a';
	a[i + 3][j + 3] = a[i + 3][j + 2] = cou++ % 26 + 'a';
}
void do5(int i, int j) {
	a[i + 2][j + 1] = a[i + 2][j + 0] = cou++ % 26 + 'a';
	a[i + 3][j + 1] = a[i + 3][j + 0] = cou++ % 26 + 'a';
	a[i + 4][j + 1] = a[i + 4][j + 0] = cou++ % 26 + 'a';
	a[i + 1][j + 2] = a[i + 0][j + 2] = cou++ % 26 + 'a';
	a[i + 4][j + 2] = a[i + 3][j + 2] = cou++ % 26 + 'a';
	a[i + 1][j + 3] = a[i + 0][j + 3] = cou++ % 26 + 'a';
	a[i + 2][j + 3] = a[i + 2][j + 2] = cou++ % 26 + 'a';
	a[i + 1][j + 4] = a[i + 0][j + 4] = cou++ % 26 + 'a';
	a[i + 3][j + 4] = a[i + 2][j + 4] = cou++ % 26 + 'a';
	a[i + 4][j + 4] = a[i + 4][j + 3] = cou++ % 26 + 'a';
}
void do6(int i, int j) {
	a[i + 3][j + 1] = a[i + 3][j + 0] = cou++ % 26 + 'a';
	a[i + 4][j + 1] = a[i + 4][j + 0] = cou++ % 26 + 'a';
	a[i + 5][j + 1] = a[i + 5][j + 0] = cou++ % 26 + 'a';
	a[i + 0][j + 3] = a[i + 0][j + 2] = cou++ % 26 + 'a';
	a[i + 1][j + 3] = a[i + 1][j + 2] = cou++ % 26 + 'a';
	a[i + 2][j + 3] = a[i + 2][j + 2] = cou++ % 26 + 'a';
	a[i + 1][j + 4] = a[i + 0][j + 4] = cou++ % 26 + 'a';
	a[i + 3][j + 4] = a[i + 2][j + 4] = cou++ % 26 + 'a';
	a[i + 5][j + 4] = a[i + 4][j + 4] = cou++ % 26 + 'a';
	a[i + 1][j + 5] = a[i + 0][j + 5] = cou++ % 26 + 'a';
	a[i + 3][j + 5] = a[i + 2][j + 5] = cou++ % 26 + 'a';
	a[i + 5][j + 5] = a[i + 4][j + 5] = cou++ % 26 + 'a';
}
void do7(int i, int j) {
	a[i + 0][j + 4] = a[i + 0][j + 3] = cou++ % 26 + 'a';
	a[i + 1][j + 6] = a[i + 0][j + 6] = cou++ % 26 + 'a';
	a[i + 4][j + 2] = a[i + 4][j + 1] = cou++ % 26 + 'a';
	a[i + 4][j + 0] = a[i + 3][j + 0] = cou++ % 26 + 'a';
	a[i + 4][j + 4] = a[i + 3][j + 4] = cou++ % 26 + 'a';
	a[i + 5][j + 6] = a[i + 5][j + 5] = cou++ % 26 + 'a';
	a[i + 2][j + 3] = a[i + 2][j + 2] = cou++ % 26 + 'a';
	a[i + 3][j + 5] = a[i + 2][j + 5] = cou++ % 26 + 'a';
	a[i + 2][j + 4] = a[i + 1][j + 4] = cou++ % 26 + 'a';
	a[i + 6][j + 3] = a[i + 5][j + 3] = cou++ % 26 + 'a';
	a[i + 1][j + 1] = a[i + 1][j + 0] = cou++ % 26 + 'a';
	a[i + 6][j + 0] = a[i + 5][j + 0] = cou++ % 26 + 'a';
	a[i + 6][j + 6] = a[i + 6][j + 5] = cou++ % 26 + 'a';
	a[i + 0][j + 2] = a[i + 0][j + 1] = cou++ % 26 + 'a';
}
void bt(int p) {
	if (p == (int) blocks.size()) {
		REP(i, 2 * n) if (cov[i] != k) return;
		REP(i, n * n)
			printf("%4d%c", is[i], i % n == n - 1 ? '\n' : ' ');
		set <int> seen;
		REP(i, n * n) if (is[i] != -1) seen.insert(is[i]);
		for (int x : seen) {
			int v0 = blocks[x].first[0], v1 = blocks[x].first[1];
			printf("\ta[i + %d][j + %d] = a[i + %d][j + %d] = cou++ %% 26 + 'a';\n", v0 % n, v0 / n, v1 % n, v1 / n);
		}
		exit(0);
	}
	bt(p + 1);
	for (int x : blocks[p].first)
		if (is[x] != -1)
			return;
	for (int x : blocks[p].second)
		if (cov[x] == k)
			return;
	for (int x : blocks[p].first) is[x] = p;
	for (int x : blocks[p].second) cov[x]++;
	bt(p + 1);
	for (int x : blocks[p].first) is[x] = -1;
	for (int x : blocks[p].second) cov[x]--;
}
void go() {
	int n;
	scanf("%d\n", &n);
	if (n == 2)
		printf("-1\n");
	else if (n == 3)
		printf("aab\nc.b\ncdd\n");
	else {
		REP(i, n) REP(j, n) a[i][j] = '.';
		int p = 0;
		if (n % 4 == 1) {
			do5(p, p);
			p += 5;
		}
		if (n % 4 == 2) {
			do6(p, p);
			p += 6;
		}
		if (n % 4 == 3) {
			do7(p, p);
			p += 7;
		}
		while (p < n) {
			do4(p, p);
			p += 4;
		}
		REP(i, n) printf("%s\n", a[i]);
	}
	exit(0);
}
int main() {
	go();
	memset(is, -1, sizeof(is));
	scanf("%d%d", &n, &k);
	REP(i, n) REP(j, n) {
		int a = nr(i, j);
		if (i) {
			int b = nr(i - 1, j);
			blocks.emplace_back(array<int, 2>{a, b}, array<int, 3>{row(i), row(i - 1), col(j)});
		}
		if (j) {
			int b = nr(i, j - 1);
			blocks.emplace_back(array<int, 2>{a, b}, array<int, 3>{row(i), col(j), col(j - 1)});
		}
	}
	random_shuffle(ALL(blocks));
	debug(imie(blocks));
	bt(0);
}


Measured memory_bytes: 2176