#include <bits/stdc++.h>
using namespace std;
int ans, ansx, ansy;
int n1, m1, n2, m2;
char arr[110][110];
char brr[110][110];
int main() {
  int i, j, k, x, y;
  while (scanf("%d%d", &n1, &m1) != EOF) {
    for (i = 1; i <= n1; ++i) scanf("%s", arr[i] + 1);
    scanf("%d%d", &n2, &m2);
    for (i = 1; i <= n2; ++i) scanf("%s", brr[i] + 1);
    ansx = ansy = 0;
    ans = 0;
    for (x = -50; x <= 50; ++x)
      for (y = -50; y <= 50; ++y) {
        int cnt = 0;
        for (i = 1; i <= n1; ++i)
          for (j = 1; j <= m1; ++j) {
            int ii = i + x;
            int jj = j + y;
            if (ii >= 1 && ii <= n2 && jj >= 1 && jj <= m2) {
              cnt += (arr[i][j] - '0') * (brr[ii][jj] - '0');
            }
            if (cnt > ans) {
              ans = cnt;
              ansx = x;
              ansy = y;
            }
          }
      }
    printf("%d %d\n", ansx, ansy);
  }
}
