#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using i32 = int32_t;
using ui32 = uint32_t;
using i64 = int64_t;
using ui64 = uint64_t;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
static int constexpr dbg = 0;
ll constexpr NM = 51;
int8_t a[NM][NM];
int8_t b[NM][NM];
int main(int argc, char *argv[]) {
  if (!dbg) {
    std::ios::sync_with_stdio(false);
  }
  int na, ma, nb, mb;
  string str;
  cin >> na >> ma;
  for (int i = 1; i <= (int)(na); ++i) {
    cin >> str;
    for (int j = 0; j < (int)(ma); ++j) a[i][j + 1] = str[j] - '0';
  }
  cin >> nb >> mb;
  for (int i = 1; i <= (int)(nb); ++i) {
    cin >> str;
    for (int j = 0; j < (int)(mb); ++j) b[i][j + 1] = str[j] - '0';
  }
  int mv, mx, my;
  mv = mx = my = 0;
  for (int x = -NM; x < NM; ++x)
    for (int y = -NM; y < NM; ++y) {
      int val = 0;
      for (int i = 1; i <= na; ++i)
        for (int j = 1; j <= ma; ++j) {
          if (x + i >= 1 && x + i <= nb && y + j >= 1 && y + j <= mb)
            val += a[i][j] * b[x + i][y + j];
        }
      if (val > mv) {
        mv = val;
        mx = x;
        my = y;
      }
    }
  cout << mx << ' ' << my << '\n';
  return 0;
}
