#include <bits/stdc++.h>
using namespace std;
int a, kol, i, j, t, n, m, q, w, Q, W, Max, sum, x, y;
string s[101], S[101];
int main() {
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> s[i];
  cin >> q >> w;
  for (i = 0; i < q; i++) cin >> S[i];
  for (x = -51; x < 52; x++)
    for (y = -51; y < 52; y++) {
      sum = 0;
      for (i = 0; i < n; i++)
        for (j = 0; j < m; j++)
          if (i + x >= 0 && i + x < q && j + y >= 0 && j + y < w)
            if (s[i][j] == S[i + x][j + y] && S[i + x][j + y] == '1') sum++;
      if (Max < sum) {
        Max = sum;
        Q = x;
        W = y;
      }
    }
  cout << Q << " " << W;
  return 0;
}
