#include <bits/stdc++.h>
using namespace std;

int N,X,Y,Z;
int A[16][16];

int main() {
	cin>>N>>X>>Y>>Z;
	--X; --Y; --Z;

	for(int y=0;y<N;++y){
		for(int x=0;x<N;++x){
			int i=y*N+x;
			A[y][x]=(x+1^y+1)&2?N*N-1-i:i;
		}
	}

	for(int y=0;y<N;++y){
		for(int x=0;x<N;++x){
			cout<<(A[y][x]^A[Y][X]^Z)+1<<" ";
		}
		cout<<endl;
	}

	return 0;
}