/*
#include <stdio.h>
int a[101][101]={};
int queue[2][10000]={};
int back=-1, front=-1;
int n, x, y;
int pb=0, pc=0;
void push(int b, int c)
{
back++;
queue[0][back]=b;
queue[1][back]=c;
}
void pop()
{
if(back==front)
{
return ;
}
else
{
front++;
pb = queue[0][front];
pc = queue[1][front];
}
}
int bfs(int b, int c)
{
int u;
int k=1;
push(b,c);
a[b][c]=k;
while(front!=back)
{
u = back;
k++;
for(;front!=u;)
{
pop();
if(pb-1>0 && a[pb-1][pc]==0)
{
push(pb-1, pc);
a[pb-1][pc]=k;
}
if(pb+1<=n && a[pb+1][pc]==0)
{
push(pb+1, pc);
a[pb+1][pc]=k;
}
if(pc-1>0 && a[pb][pc-1]==0)
{
push(pb, pc-1);
a[pb][pc-1]=k;
}
if(pc+1<=n && a[pb][pc+1]==0)
{
push(pb, pc+1);
a[pb][pc+1]=k;
}
}
}
}
int main()
{
scanf("%d", &n);
scanf("%d %d", &x, &y);
bfs(x, y);
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
printf("%d ", a[i][j]);
}
printf("\n");
}
return 0;
}
*/