#include<bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define endl "\n"
const int N=410;
pair<int,int> q[N*N];
int n,m;
int dist[N][N];
int dx[]={2,2,1,1,-1,-1,-2,-2};
int dy[]={1,-1,2,-2,2,-2,1,-1};
void bfs(int x1,int x2)
{
memset(dist,-1,sizeof(dist));
int hh=0,tt=-1;
q[++tt]={x1,x2};
dist[x1][x2]=0;
while(hh<=tt)
{
auto t=q[hh++];
for(int i=0;i<8;i++)
{
int a=t.x+dx[i];
int b=t.y+dy[i];
if(a<1||a>n||b<1||b>m)
{
continue;
}
if(dist[a][b]>=0) continue;
dist[a][b]=dist[t.x][t.y]+1;
q[++tt]={a,b};
}
}}
int main()
{
int x_1,y_1;
cin>>n>>m>>x_1>>y_1;
bfs(x_1,y_1);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
cout<<left<<setw(5)<<dist[i][j];
}
cout<<endl;
}
return 0;
}