#include<iostream>
using namespace std;
int a[405][405];
int n, m, x, y;
void dfs(int i, int j, int num)
{
if (i < 1 || i > n || j < 1 || j > m)
return;
if (a[i][j] != 0 && a[i][j] <= num)
return;
a[i][j] = num;
dfs(i + 2, j + 1, num + 1);
dfs(i + 2, j - 1, num + 1);
dfs(i - 2, j + 1, num + 1);
dfs(i - 2, j - 1, num + 1);
dfs(i - 1, j + 2, num + 1);
dfs(i + 1, j + 2, num + 1);
dfs(i - 1, j - 2, num + 1);
dfs(i + 1, j - 2, num + 1);
}
int main()
{
cin >> n >> m >> x >> y;
dfs(x + 2, y + 1, 1);
dfs(x + 2, y - 1, 1);
dfs(x - 2, y + 1, 1);
dfs(x - 2, y - 1, 1);
dfs(x - 1, y + 2, 1);
dfs(x + 1, y + 2, 1);
dfs(x - 1, y - 2, 1);
dfs(x + 1, y - 2, 1);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
if (i == x && j == y)
cout << "0 ";
else if (a[i][j] == 0)
cout << "-1 ";
else
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
}