#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > maketable() {
  int h, w;
  cin >> h >> w;
  vector<vector<int> > res(h, vector<int>(w, 0));
  for (int i = (int)(0); i < (int)(h); ++i) {
    for (int j = (int)(0); j < (int)(w); ++j) {
      char c;
      cin >> c;
      res[i][j] = c - '0';
    }
  }
  return res;
}
int calc(const vector<vector<int> > &a, const vector<vector<int> > &b, int x,
         int y) {
  const int ah = a.size(), aw = a[0].size(), bh = b.size(), bw = b[0].size();
  int res = 0;
  for (int i = (int)(0); i < (int)(ah); ++i) {
    for (int j = (int)(0); j < (int)(aw); ++j) {
      if (0 <= i + x && i + x < bh && 0 <= j + y && j + y < bw) {
        res += a[i][j] * b[i + x][j + y];
      }
    }
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int> > a = maketable(), b = maketable();
  int max = INT_MIN, res1, res2;
  for (int i = (int)(-50); i < (int)(51); ++i) {
    for (int j = (int)(-50); j < (int)(51); ++j) {
      int tmp = calc(a, b, i, j);
      if (max < tmp) {
        max = tmp;
        res1 = i;
        res2 = j;
      }
    }
  }
  cout << res1 << ' ' << res2 << endl;
  return 0;
}
