#include <bits/stdc++.h>
using namespace std;
const int N = 400+10;
int n, m, x, y;
struct Node {
int X, Y;
};
int a[N][N];
bool vis[N][N];
const int dx[8] = {-2,+2,-1,+1,-2,+2,-1,+1};
const int dy[8] = {-1,-1,-2,-2,+1,+1,+2,+2};
void bfs() {
queue <Node> q;
q.push({x, y});
while(!q.empty()) {
Node k = q.front(); q.pop();
vis[k.X][k.Y] = true;
for(int i = 0; i < 8; i++) {
int cx = k.X+dx[i], cy = k.Y+dy[i];
if(cx < 1 || cx > n || cy < 1 || cy > m) continue;
if(vis[cx][cy] == true) continue;
a[cx][cy] = a[k.X][k.Y] + 1;
q.push({cx, cy});
}
}
}
int main() {
cin >> n >> m >> x >> y;
memset(a, -1, sizeof(a));
a[x][y] = 0;
bfs();
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++)
cout << a[i][j] << ' ';
cout << endl;
}
return 0;
}
dalao救我