#include <bits/stdc++.h>
using namespace std;
const int dx[8] = {1,1,-1,-1,2,2,-2,-2};
const int dy[8] = {2,-2,2,-2,1,-1,1,-1};
int n, m, x, y;
struct index{
int x;
int y;
int len;
};
int interval(int aa, int xx, int bb) {
if (xx < aa)
return 0;
if (xx > bb)
return 0;
return 1;
}
int vhash[401][401];
int bfs(int xx, int yy) {
queue<index> a;
while (!a.empty())
a.pop();
memset(vhash, 0, sizeof(vhash));
index sou = {xx, yy, 0};
a.push(sou);
vhash[xx][yy] = 1;
while (!a.empty()) {
index pre = a.front();
if (pre.x == x && pre.y == y)
return pre.len;
for (int k = 0; k < 8; k++) {
int nx = pre.x + dx[k];
int ny = pre.y + dy[k];
if (interval(1, nx, n) && interval(1, ny, m) && vhash[nx][ny] == 0) {
index cur = {nx, ny, pre.len + 1};
vhash[nx][ny] = 1;
a.push(cur);
}
}
a.pop();
}
return -1;
}
int main() {
scanf("%d%d%d%d", &n, &m, &x, &y);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++)
printf("%-5d", bfs(i, j));
printf("\n");
}
return 0;
}