#include<bits/stdc++.h>
using namespace std;
int n,m,x,y;
int dx[8]={2,2,1,1,-2,-2,-1,-1};
int dy[8]={1,-1,2,-2,1,-1,2,-2};
int out[405][405];
bool vis[405][405];
struct node
{
int x,y;
};
queue<node>q;
queue<int>p;
inline void init()
{
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++) out[i][j]=-1;
}
inline void bfs()
{
int step=0;
while(!q.empty())
{
node now=q.front();
step=p.front();
out[x][y]=step;
q.pop(),p.pop();
for(int i=0;i<8;i++)
{
int a=now.x+dx[i],b=now.y+dy[i];
if(a<1 || a>n || b<1 || b>m || vis[a][b]) continue;
vis[a][b]=true;
q.push({a,b});
p.push(step+1);
}
}
}
int main()
{
cin>>n>>m>>x>>y;
init();
q.push({x,y});
p.push(0);
vis[x][y]=1;
bfs();
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
cout<<out[i][j]<<" ";
cout<<endl;
}
}