# include <bits/stdc++.h>
using namespace std;
struct node{
int X,Y,cnt;
};
int n,m,x,y,h,t,res[405][405],nex[8][2]={{-2,-1},{-2,1},{2,1},{2,-1},{1,2},{1,-2},{-1,2},{-1,-2}};
bool flag[405][405];
node que[2000];
int main(){
memset(res,-1,sizeof(res));
cin>>n>>m>>x>>y;
que[t++]=node{x,y,0};
res[x][y]=0;
while(h!=t){
for(int i = 0;i < 8;i++){
int hx=que[h].X + nex[i][0] ,hy = que[h].Y + nex[i][1] ,cnt=que[h].cnt+1;
if(hx <= 0 || hx > n || hy <= 0 || hy > m || res[hx][hy]!=-1) continue;
res[hx][hy] = cnt;
que[t++] = (node){hx ,hy ,cnt};
}h++;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cout<<res[i][j]<<" ";
}
cout<<endl;
}
return 0;
}