#include <bits/stdc++.h>
using namespace std;
const int MAXN = 50 + 10;
bool arr[4][MAXN][MAXN];
int sx[4];
int sy[4];
int main() {
  std::ios::sync_with_stdio(false);
  int ansx, ansy, ans = 0;
  char c;
  for (int i = 0; i < 2; ++i) {
    cin >> sx[i] >> sy[i];
    for (int j = 1; j <= sx[i]; ++j) {
      for (int k = 1; k <= sy[i]; ++k) {
        cin >> c;
        arr[i][j][k] = c - '0';
      }
    }
  }
  for (int x = -50; x <= 50; ++x) {
    for (int y = -50; y <= 50; ++y) {
      int cur = 0;
      for (int i = 1; i <= sx[0]; ++i) {
        for (int j = 1; j <= sy[0]; ++j) {
          if (i + x < 1 || sx[1] < i + x) continue;
          if (j + y < 1 || sy[1] < j + y) continue;
          cur += arr[0][i][j] * arr[1][i + x][j + y];
        }
      }
      if (cur > ans) {
        ans = cur;
        ansx = x;
        ansy = y;
      }
    }
  }
  cout << ansx << " " << ansy << "\n";
  return 0;
}
