#include <bits/stdc++.h>
using namespace std;
int n, m;
bool b[401][401];
int ans[401][401];
int opt[8][2] = {{2, 1}, {1, 2}, {-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}};
struct place {
int x, y;
};
queue<place> q;
int main() {
memset(ans, -1, sizeof(ans));
cin >> n >> m;
int mx, my;
cin >> mx >> my;
place a;
a.x = mx;
a.y = my;
q.push(a);
b[mx][my] = 1;
while (!q.empty()) {
place now = q.front();
q.pop();
for (int i = 0; i <= 7; i++) {
int x = now.x, y = now.y;
int u = x + opt[i][0];
int v = y + opt[i][1];
if (u >= 1 && u <= n && v >= 1 && v <= m && !b[u][v]) {
ans[u][v] = ans[x][y] + 1;
b[u][v] = 1;
q.push({u, v});
}
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
printf("%-5d", ans[i][j]);
}
printf("\n");
}
return 0;
}