#include<bits/stdc++.h>
using namespace std;
int n,m,ans[405][405];
int direx[10]={-2,-2,2,2,1,-1,-1,1};
int direy[10]={1,-1,-1,1,-2,-2,2,2};
bool visit[405][405];
struct Point
{
int x,y;
}horse;
bool in_scp(int bef,int ob,int aft)
{
return bef<=ob && ob<=aft;
}
void DFS(int x,int y,int endx,int endy,int step)
{
if(x==endx && y==endy)
ans[endy][endx]=min(ans[endy][endx],step);
else
for(int i=0;i<=7;i++)
if(!visit[y+direy[i]][x+direx[i]] && in_scp(1,y+direy[i],n) && in_scp(1,x+direx[i],n))
visit[y+direy[i]][x+direx[i]]=1,DFS(x+direx[i],y+direy[i],endx,endy,step+1),visit[y+direy[i]][x+direx[i]]=0;
}
int main()
{
cin>>n>>m>>horse.x>>horse.y,memset(ans,2147483647,sizeof ans);
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
DFS(horse.x,horse.y,j,i,0);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
cout<<ans[i][j]<<' ';
cout<<endl;
}
return 0;
}