#include<cstdio>
#include<string>
#include<iostream>
using namespace std;
string a[105];
int main(){
int h,w,a1,b2,b1,a2;
scanf("%d%d%d%d%d%d",&h,&w,&a1,&a2,&b1,&b2);
for(int i = 1; i <= h; i++){
for(int j = 1; j <= w; j++){
cin >> a[i][j];
}
}
for(int i = a1; i <= a2; i++){
for(int j = b1; j <= b2; j++){
cout << a[i][j];
}
cout << endl;
}
return 0;
}