#include <bits/stdc++.h>
using namespace std;
long long x , y , n , m , a[440][440] , c = 0x5f ;
int j[8][2] = {{1,2},{1,-2},{-1,2},{-1,-2},{2,1},{-2,1},{-2,-1},{2,-1}};
bool b[440][440] ;
queue <int> q ;
void bfs(){
int x , y ;
if(q.empty()) return ;
x = q.front() ;
q.pop() ;
y = q.front() ;
q.pop() ;
for(int i = 0 ; i < 8 ; i++){
if((x+j[i][0]<=n)&&(x+j[i][0]>0)&&(y+j[i][1]<=m)&&(y+j[i][1]>0)&&(!b[x+j[i][0]][y+j[i][1]])){
b[x+j[i][0]][y+j[i][1]] = 1 ;
a[x+j[i][0]][y+j[i][1]] = a[x][y]+1 ;
q.push(x+j[i][0]) ;
q.push(y+j[i][1]) ;
}
}
bfs() ;
}
int main(){
cin >> n >> m >> x >> y ;
for(int i = 1 ; i <= n ; i++){
for(int o = 1 ; o <= m ; o++){
a[i][o] = c ;
}
}
a[x][y] = 0 ;
b[x][y] = 1 ;
q.push(x) ;
q.push(y) ;
bfs() ;
for(int i = 1 ; i <= n ; i++){
for(int o = 1 ; o <= m ; o++){
if(a[i][o]==c) cout << "-1 " ;
else cout << a[i][o] << " " ;
}
cout << endl ;
}
}