#include <bits/stdc++.h>
using namespace std;
long long a[100][100] = {0};
long long b[100][100] = {0};
int main() {
  long long na, ma, nb, mb, i, j, k, l, sum = 0, maxsum = -1, maxx = -1,
                                        maxy = -1;
  cin >> na >> ma;
  string str;
  for (i = 1; i <= na; i++) {
    cin >> str;
    for (j = 0; j < str.length(); j++) {
      a[i][j + 1] = str[j] - '0';
    }
  }
  cin >> nb >> mb;
  for (i = 1; i <= nb; i++) {
    cin >> str;
    for (j = 0; j < str.length(); j++) {
      b[i][j + 1] = str[j] - '0';
    }
  }
  for (k = 1 - na; k <= nb - 1; k++) {
    for (l = 1 - ma; l <= mb - 1; l++) {
      sum = 0;
      for (i = 1; i <= na; i++) {
        for (j = 1; j <= ma; j++) {
          if (i + k >= 1 && i + k <= nb && j + l >= 1 && j + l <= mb) {
            sum += (a[i][j] * b[i + k][j + l]);
            if (sum > maxsum) {
              maxx = k;
              maxy = l;
              maxsum = sum;
            }
          }
        }
      }
    }
  }
  cout << maxx << " " << maxy << endl;
  return 0;
}
