#include<bits/stdc++.h>
using namespace std;
const int maxn=100005;
int qp[405][405];
int n,m,Ax,Ay;
bool Check(int x,int y){return x<=n&&x>0&&y>0&&y<=m;}
int a[8][2]={{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{-1,2},{1,-2},{-1,-2}};
struct node
{
int x,y;
};
void BFS(int dx,int dy)
{
queue <node> q;
qp[dx][dy]=0;
node start,next;
start.x=dx;
start.y=dy;
q.push(start);
while(!q.empty())
{
start=q.front();
q.pop();
for(int i=0;i<8;i++)
{
next.x=start.x+qp[i][0];
next.y=start.y+qp[i][1];
if(Check(next.x,next.y)&&qp[next.x][next.y]==-1)
{
qp[next.x][next.y]=qp[start.x][start.y]+1;
q.push(next);
}
}
}
}
int main()
{
memset(qp,-1,sizeof(qp));
cin>>n>>m>>Ax>>Ay;
BFS(Ax,Ay);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
printf("%-5d",qp[i][j]);
printf("\n");
}
return 0;
}