#include <bits/stdc++.h>
using namespace std;
const int N = 410;
typedef pair<int, int>pii;
int n, m, x, y;
int g[N][N];
bool st[N][N];
int dx[8] = {-2, -2, -1, 1, 2, 2, 1, -1};
int dy[8] = {-1, 1, 2, 2, 1, -1, -2, -2};
queue<pii>q;
void bfs(int x, int y){
q.push({x, y});
st[x][y] = 1;
while(q.size()){
auto t = q.front();
q.pop();
x = t.first, y = t.second;
// cout << x << " " << y << endl;
for(int i = 0;i < 8;i++){
int xx = x + dx[i], yy = y + dy[i];
if(xx >= 1 && xx <= n && yy >= 1 && yy <= m && !st[xx][yy]){
st[xx][yy] = 1;
q.push({xx, yy});
g[xx][yy] = g[x][y] + 1;
}
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> x >> y;
memset(g, -1, sizeof g);
g[x][y] = 0;
bfs(x, y);
for(int i = 1;i <= n;i++)
{
for(int j = 1;j <= m;j++){
cout << g[i][j] << " ";
}
cout << endl;
}
return 0;
}