#include<bits/stdc++.h>
using namespace std;
int x,y,n,m;
int a[500][500];
bool vis[500][500];
int dj[500][500];
struct node{
int xx,yy;
};
queue<node> q;
int xxx[8]={-2,-1,1,2,2,1,-1,-2};
int yyy[8]={-1,-2,-2,-1,1,2,2,1};
bool check(int a,int b){
return a>=1&&a<=n&&b>=1&&b<=m&&vis[a][b]==0;
}
void bfs(){
q.push(node{x,y});
vis[x][y]=1;
dj[x][y]=0;
int a,b;
while(!q.empty()){
for(int i=0;i<8;++i){
a=q.front().xx;
b=q.front().yy;
a+=xxx[i];
b+=yyy[i];
if(check(a,b)){
dj[a][b]=dj[q.front().xx][q.front().yy]+1;
vis[a][b]=1;
}
}
}
}
int main(){
cin>>n>>m>>x>>y;
memset(dj,-1,sizeof(dj));
bfs();
for(int i=1;i<=n;++i){
for(int j=1;j<=m;++j){
if(dj[i][j]<0) cout<<-1;
else cout<<setw(5)<<dj[i][j];
}
cout<<"\n";
}
return 0;
}
0