#include <bits/stdc++.h>
using namespace std;
int a[55][55];
int b[55][55];
int f(int na, int ma, int nb, int mb, int y, int x) {
  int ret = 0;
  for (int j = 0; j < mb; j++) {
    for (int i = 0; i < nb; i++) {
      if ((i + x >= 0 && j + y >= 0)) {
        if (a[i][j] == 1 && b[i + x][j + y] == 1) {
          ret++;
        }
      }
    }
  }
  return ret;
}
int main() {
  int na, ma, nb, mb;
  while (scanf("%d%d", &na, &ma) != EOF) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    for (int i = 0; i < na; i++) {
      for (int j = 0; j < ma; j++) {
        scanf("%1d", &a[i][j]);
      }
    }
    scanf("%d%d", &nb, &mb);
    for (int i = 0; i < nb; i++) {
      for (int j = 0; j < mb; j++) {
        scanf("%1d", &b[i][j]);
      }
    }
    int max = -1000000;
    int ans_x = 0, ans_y = 0;
    for (int x = -(ma - 1); x <= mb - 1; x++) {
      for (int y = -(na - 1); y <= nb - 1; y++) {
        int cnt = f(nb, mb, na, ma, x, y);
        if (cnt > max) {
          ans_x = y;
          ans_y = x;
          max = cnt;
        }
      }
    }
    printf("%d %d\n", ans_x, ans_y);
  }
  return 0;
}
