#include<bits/stdc++.h>
using namespace std;
struct node{
int x,y;
};
int dx[]={-1,-2,2,1,-1,-2,1,2};
int dy[]={-2,-1,-1,-2,2,1,2,1};
int n,m,x1,y1;
int a[401][401];
void bfs(int x,int y){
a[x1][y1] = 0;
queue<node> q;
q.push({x,y});
while(!q.empty()){
node q1 = q.front();
q.pop();
for(int i = 0; i < 8; i++){
int xx = q1.x+dx[i],yy = q1.y+dy[i];
if(xx > 0 && xx <= n && yy > 0 && yy <= n && a[xx][yy] == -1){
a[xx][yy] = a[q1.x][q1.y]+1;
q.push({xx,yy});
}
}
}
}
int main(){
scanf("%d%d%d%d",&n,&m,&x1,&y1);
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
a[i][j] = -1;
}
}
bfs(x1,y1);
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
printf("%d ",a[i][j]);
}
printf("\n");
}
return 0;
}