#include<iostream>
#include<iterator>
#include<algorithm>
using namespace std;

/*
*棋盘覆盖问题
*/

static int t=0;
void ChessBoard(int **map,int r,int l,int pr,int pl,int size)
{
	if(1==size) {return;}
	t++;
	int it = t;
	//左上角
	if(pr<r+size/2&&pl<l+size/2)
		ChessBoard(map,r,l,pr,pl,size/2);
	else
	{
		map[r+size/2-1][l+size/2-1]=it;
		ChessBoard(map,r,l,r+size/2-1,l+size/2-1,size/2);
	}
	//右上角
	if(pr<r+size/2&&pl>=l+size/2)
		ChessBoard(map,r,l+size/2,pr,pl,size/2);
	else
	{
		map[r+size/2-1][l+size/2]=it;
		ChessBoard(map,r,l+size/2,r+size/2-1,l+size/2,size/2);
	}
	//左下角
	if(pr>=r+size/2&&pl<l+size/2)
		ChessBoard(map,r+size/2,l,pr,pl,size/2);
	else
	{
		map[r+size/2][l+size/2-1]=it;
		ChessBoard(map,r+size/2,l,r+size/2,l+size/2-1,size/2);
	}
	//右下角
	if(pr>=r+size/2&&pl>=l+size/2)
		ChessBoard(map,r+size/2,l+size/2,pr,pl,size/2);
	else
	{
		map[r+size/2][l+size/2]=it;
		ChessBoard(map,r+size/2,l+size/2,r+size/2,l+size/2,size/2);
	}
}

int main()
{
	int k=1,s;//棋盘的大小
	int r,l;//残缺方格的位置
	cin>>s;
	k<<=s;
	cin>>r>>l;
	int ** map = new int*[k];
	for (int i = 0; i < k; i++)
	{
		map[i] = new int[k];
	}
	map[r][l] = 0;
	//运算
	ChessBoard(map,0,0,r,l,k);
	//输出结果
	for (int i = 0; i < k; i++)
	{
		copy(map[i],map[i]+k,ostream_iterator<int>(cout," "));
		cout<<endl;
	}

}