#include<bits/stdc++.h>
using namespace std;
// typedef pair<int,int>PII
struct point
{
int x,y;
};
const int N = 1000;
int n,m,x,y;
int maze[N][N];
int d[N][N];//存步数
//(1 2)(2 1)(2 -1)(1 -2)
//(-1 -2)(-2 -1)(-2 1)(-1 2)
int dx[8]={1,2,2,1,-1,-2,-2,-1};
int dy[8]={2,1,-1,-2,-2,-1,1,2};
void bfs(int x,int y)
{
queue<point> q;
memset(d,-1,sizeof(d));
d[x][y]=0;
q.push({x,y});
while(!q.empty())
{
auto t = q.front();
q.pop();
for(int i=0;i<8;i++)
{
int nx =t.x + dx[i];
int ny =t.y + dy[i];
if(nx>0 and nx<=n and ny>0 and ny<=m and d[nx][ny]==-1)
{
d[nx][ny]=d[t.x][t.y]+1;
q.push({nx,ny});
}
}
}
}
int main()
{
cin>>n>>m>>x>>y;
bfs(x,y);
for(int i= 1;i<=n;i++){
for(int j=1;j<=m;j++)
cout<<d[i][j]<<" ";
cout<<endl;
}
return 0;
}