#include <cstdio>#include <cstring>#include <algorithm>#include <vector>using namespace std;#define N 45char a[N*3][N*3], b[N][N];struct node{ int x, y, l, r, t, b, s;}tmp, ans;int c[N], l[N], r[N];int main(){ int m1, n1, m2, n2; while (scanf ("%d%d", &m1, &n1) == 2){ memset(a, '#', sizeof(a)); for (int i = 0; i < m1; i++){ scanf ("%s", a[i+N] + N); } scanf ("%d%d", &m2, &n2); for (int i = 0; i < m2; i++){ scanf ("%s", b[i]); } ans.s = 0; for (tmp.x = -m2+1; tmp.x < m1; tmp.x++){ for (tmp.y = -n2+1; tmp.y < n1; tmp.y++){ memset(c, 0, sizeof(c)); for (int i = 0; i < m2; i++){ for (int j = 0; j < n2; j++){ if (a[tmp.x + N + i][tmp.y + N + j] == b[i][j]) c[j]++; else c[j] = 0; } for (int j = 0; j < n2; j++){ int k = j - 1; while (k >= 0 && c[k] >= c[j]){ k = l[k]; } l[j] = k; } for (int j = n2-1; j >= 0; j--){ int k = j+1; while (k < n2 && c[k] >= c[j]){ k = r[k]; } r[j] = k; } for (int j = 0; j < n2; j++){ tmp.l = l[j] + 1; tmp.r = r[j] - 1; tmp.t = i - c[j] + 1; tmp.b = i; tmp.s = (tmp.r - tmp.l + 1) * (tmp.b - tmp.t + 1); if (tmp.s > ans.s){ ans = tmp; } } } } } if (ans.s == 0){ printf ("0 0n"); }else{ printf ("%d %dn%d %dn%d %dn", ans.b - ans.t + 1, ans.r - ans.l + 1, ans.x + ans.t + 1, ans.y + ans.l + 1, ans.t + 1, ans.l + 1 ); } } return 0;}


