#include <fstream>
using namespace std;
long i,j,x,y,kq = -1000;
long matran[10000][10000];
long tongb(long a,long b)
{
	long tong = 0;
	for (long n = a; n < x+a; n++)
	{
		for (long m = b; m < y+b; m++)
		{
			tong = tong + matran[n][m];
		}
	}
	return tong;
}
long matranb[10000][10000];
void kq2(long a,long b)
{
	for (long n = a; n < x+a; n++)
	{
		for (long m = b; m < y+b; m++)
		{
			matranb[n-a][m-b] = matran[n][m];
		}
	}
}
int main()
{
	ifstream fi("matran.inp");
	ofstream fo("matran.out");
    fi>> i >> j;
    for (long n = 0; n < i; n++)
	{
		for (long m = 0; m < j; m++) cin >> matran[n][m];
	}
	cin >> x >> y;
	for (long n = 0; n <= i-x; n++)
	{
		for (long m = 0; m <= j-y; m++)
		{
			if (kq < tongb(n,m)) {kq = tongb(n,m);kq2(n,m);}
		}
	}
	for (long n = 0; n < x; n++)
	{
		for (long m = 0; m < y; m++) fo << matranb[n][m] << " ";
		fo<< endl;
	}
	fi.close();
	fo.close();
    return 0;
}
