#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
int chest[500][500];
bool vis[500][500];
int n, m,dx,dy, move1[8][2] = { {1,-2},{-1,-2},{2,-1},{2,1},{1,2},{-1,2},{-2,1},{-2,-1} };
#define CHECK(x,y) (x <= n && y <= m && x > 0 && y > 0)
queue<int>qx,qy;
int main(){
cin >> n >> m>>dx>>dy;
vis[dx][dy] = true;
qx.push(dx), qy.push(dy);
while (!qx.empty()) {
for (int i = 0; i < 8; i++) {
int x = qx.front() + move1[i][0], y = qy.front() + move1[i][1];
if (CHECK(x, y) && !vis[x][y]) {
vis[x][y] = true;
chest[x][y] = chest[qx.front()][qx.front()] + 1;
qx.push(x),qy.push(y);
}
}
qx.pop(), qy.pop();
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if ((i != dx || j != dy) && !vis[i][j])cout << -1 << " ";
else cout << chest[i][j] << " ";
}
cout << endl;
}
}