#include<bits/stdc++.h>
using namespace std;
struct node{
int x,y;
};
int n,m,qx,qy;
bool f[511][511];
int dx[]={ 1, 1, 2, 2, -1, -1, -2, -2 };
int dy[]={ 2, -2, 1, -1, 2, -2, 1, -1 };
int ans[101][101];
queue<node> q;
void bfs()
{
while(!q.empty()){
node now=q.front();
q.pop();
for(int i=0;i<8;i++){
int xx=now.x+dx[i];
int yy=now.y+dy[i];
int bsans=ans[xx][yy];
if(xx>=1&&xx<=n&&yy>=1&&yy<=m&&!f[xx][yy])
f[xx][yy]==1;
ans[xx][yy]=bsans+1;
node temp={qx,qy} ;
q.push(temp);
}
}
}
signed main()
{
memset(ans,-1,sizeof(ans));
cin>>n>>m>>qx>>qy;
node first={qx,qy};
q.push(first);
ans[qx][qy]=0;
bfs();
for (int i=1;i<=n;i++){
for (int j=1;j<=m;j++){
printf("%-5d",ans[i][j]);
}
cout<<endl;
}
return 0;
}
