#include <bits/stdc++.h>
using namespace std;
bool isprime(int n) {
  if (n == 1) return false;
  if (n == 2) return true;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
void answer(int f) {
  if (f) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  cout << endl;
}
long long int countSetBits(long long int n) {
  long long int count = 0;
  while (n) {
    count += 1;
    n = n / 10;
  }
  return count;
}
long long int factorial(long long int n) {
  n = n % 1000000007;
  return (n == 1 || n == 0 || n < 0) ? 1 : n * factorial(n - 1);
}
long long int ncp(long long int x, long long int y) {
  long long int ans = 1;
  long long int i, j;
  long long int z = x + y;
  for (i = 0; i < x; i++) {
    ans = ans * (z);
    z--;
  }
  x = y;
  for (i = 0; i < x; i++) {
    ans = ans / y;
    y--;
  }
  long long int hj = 1;
  return min(hj, ans);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int test = 1;
  while (test--) {
    long long int i, j, a, b, c, d;
    cin >> a >> b;
    string x[a];
    for (i = 0; i < a; i++) {
      cin >> x[i];
    }
    cin >> c >> d;
    string y[c];
    for (i = 0; i < c; i++) {
      cin >> y[i];
    }
    long long int ma = 0, ans1 = 0, ans2 = 0;
    for (i = -51; i <= 52; i++) {
      for (j = -51; j <= 52; j++) {
        long long int sum = 0;
        for (int n = 0; n <= a; n++) {
          for (int m = 0; m <= b; m++) {
            if (i + n >= 0 && i + n < c && j + m >= 0 && j + m < d) {
              if (x[n][m] == y[i + n][j + m] && y[i + n][j + m] == '1') sum++;
            }
          }
        }
        if (sum > ma) {
          ma = sum;
          ans1 = i;
          ans2 = j;
        }
      }
    }
    cout << ans1 << " " << ans2 << endl;
  }
  return 0;
}
