#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<queue>
using namespace std;
const int N = 405;
typedef pair<int, int> PII;
queue<PII>q;
int n, m, sx, sy;
int bx[] = { -2,-1,1,2,2 ,1 ,-1 };
int by[] = { 1 ,2 ,2,1,-1,-2,-2 };
int steep[N][N];
void bfs(int x, int y) {
steep[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 + bx[i];
int b = t.second + by[i];
if (a<1 || b<1 || a>n || b>m||steep[a][b]!=-1)continue;
steep[a][b] = steep[t.first][t.second] + 1;
q.push({ a,b });
}
}
}
int main() {
cin >> n >> m >> sx >> sy;
memset(steep,-1, sizeof steep);
bfs(sx, sy);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
printf("%-5d", steep[i][j]);
}
cout << endl;
}
return 0;
}