#include<iostream>
#include<queue>
#include<iomanip>
#include<cstring>
using namespace std;
int xx[8]={-2,-2,-1,-1,2,2,1,1};
int yy[8]={1,-1,2,-2,1,-1,2,-2};
int n,m,sx,sy;
int mp[501][501];
struct node
{
int x,y,s;
};
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n>>m>>sx>>sy;
queue <node> q;
q.push((node){sx,sy,0});
memset(mp,-1,sizeof(mp));
mp[sx][sy]=0;
while(!q.empty())
{
node f=q.front();
q.pop();
for(int i=0;i<8;i++)
{
int nx=f.x+xx[i];
int ny=f.y+yy[i];
if(nx>=1&&nx<=n&&ny>=1&&ny<=m&&mp[nx][ny]==-1)
{
mp[nx][ny]=f.s+1;
q.push((node){nx,ny,f.s+1});
}
}
}
for(int i=1;i<=n;i++)
{
for(int j =1;j<=m;j++)
{
cout<<left<<setw(5)<<mp[i][m];
}
cout<<endl;
}
return 0;
}