// Problem: P1443 马的遍历
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1443
// Memory Limit: 128 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
const int N = 410;
int dist[N][N];
queue<PII> q;
int n, m, x, y;
int dx[8]={2,-2,2,-2,-1,1,-1,1};
int dy[8]={1,1,-1,-1,2,2,-2,-2};
void dfs(int x, int y) {
memset(dist, -1, sizeof dist);
dist[x][y] = 0;
q.push({x, y});
while (!q.empty()) {
auto t = q.front();
q.pop();
for (int i = 0; i < 8; i ++ ) {
int a = t.first + dx[i], b = t.second + dy[i];
if (a < 1 || a > n || b < 1 || b > m) continue;
if (dist[a][b] >= 0) continue;
dist[a][b] = dist[t.first][t.second] + 1;
q.push({a, b});
}
}
}
int main() {
cin >> n >> m >> x >> y;
dfs(x, y);
for (int i = 1; i <= n; i ++ ) {
for (int j = 1; j <= m; j ++ )
printf("%-5d", dist[i][j]);
puts("");
}
return 0;
}