#include <bits/stdc++.h>
using namespace std;
const int maxn = 155;
int a[maxn][maxn];
int b[maxn][maxn];
int an, am, bn, bm;
int solve(int x, int y) {
  int sum = 0;
  for (int i = 51; i <= 50 + an; i++) {
    for (int j = 51; j <= 50 + am; j++) {
      sum += a[i][j] * b[i + x][j + y];
    }
  }
  return sum;
}
int main() {
  string str;
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  cin >> an >> am;
  for (int i = 51; i <= 50 + an; i++) {
    cin >> str;
    for (int j = 51; j <= 50 + am; j++) {
      a[i][j] = str[j - 51] - '0';
    }
  }
  cin >> bn >> bm;
  for (int i = 51; i <= 50 + bn; i++) {
    cin >> str;
    for (int j = 51; j <= 50 + bm; j++) {
      b[i][j] = str[j - 51] - '0';
    }
  }
  int ans = 0;
  int ansx = 0, ansy = 0;
  for (int x = -an + 1; x < bn; x++) {
    for (int y = -am + 1; y < bm; y++) {
      int num = solve(x, y);
      if (num > ans) {
        ans = num;
        ansx = x;
        ansy = y;
      }
    }
  }
  cout << ansx << " " << ansy << endl;
  return 0;
}
