#include<iostream>
#include<bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long ll;
ll n, m, x, y;
int ww[405][405];
int dx[] = { 1,1,2,2,-1,-1,-2,-2 };
int dy[] = {2,-2,1,-1,2,-2,1,-1};
typedef struct ppp {
int x =-1;
int y = -1;
int k = -1;
bool vis = false;
};
queue<ppp>q;
int main()
{
cin >> n >> m >> x >> y;
memset(ww, -1,sizeof(ww));
ppp start;
start.x = x-1;
start.y = y-1;
start.k = 0;
q.push(start);
while (!q.empty())
{
auto head = q.front();
head.vis = true;
ww[head.x][head.y] = head.k;
q.pop();
for (size_t i = 0; i < 8; i++)
{
int tempx = head.x+dx[i];
int tempy = head.y+dy[i];
if (ww[tempx][tempy]==-1&&tempx>=0&&tempx<=n-1&&tempy>=0&&tempy<=m-1)
{
ppp newpoint;
newpoint.x = tempx;
newpoint.y = tempy;
newpoint.k = head.k + 1;
q.push(newpoint);
}
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cout << ww[i][j] << " ";
}cout << endl;
}
return 0;
}