#include<iostream>
#include<queue>
using namespace std;
struct node{
int x,y,s;
};
int x,y,n,m;
int dx[4]={0,1,0,-1};
int dy[4]={-1,0,1,0};
int main(){
cin>>n>>m>>x>>y;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
bool v[401][401]={0};
queue<node>q;
node t;
t.x=x;
t.y=y;
t.s=0;
q.push(t);
while(!(q.empty()))
{
node h=q.front();
q.pop();
if(h.x==i&&h.y==j)
{
cout<<h.s<<" ";
break;
}
for(int i=0;i<4;i++)
{
int tx=x+dx[i];
int ty=y+dy[i];
if(tx>0&&tx<=n&&ty>0&&ty<=m&&!(v[tx][ty]))
{
v[tx][ty]=1;
t.x=tx;
t.y=ty;
t.s=h.s+1;
q.push(t);
}
}
}
}
cout<<endl;
}
return 0;
}