#include <bits/stdc++.h>
using namespace std;
int input1[100][100];
int input2[100][100];
int main() {
  int n1, m1, n2, m2;
  while (cin >> n1 >> m1) {
    int i, j, x, y, max = 0, ansx = -1, ansy = -1;
    for (i = 1; i <= n1; i++) {
      char input[100];
      scanf("%s", input);
      for (j = 0; j < m1; j++) input1[i][j + 1] = input[j] - '0';
    }
    cin >> n2 >> m2;
    for (i = 1; i <= n2; i++) {
      char input[100];
      scanf("%s", input);
      for (j = 0; j < m2; j++) input2[i][j + 1] = input[j] - '0';
    }
    for (x = -n1; x <= n2; x++)
      for (y = -m1; y <= m2; y++) {
        int sum = 0;
        for (i = 1; i <= n1; i++)
          for (j = 1; j <= m1; j++) {
            if (x + i >= 1 && x + i <= n2 && y + j >= 1 && y + j <= m2)
              sum += input1[i][j] * input2[i + x][j + y];
          }
        if (sum > max) {
          max = sum;
          ansx = x;
          ansy = y;
        }
      }
    cout << ansx << " " << ansy << endl;
  }
  return 0;
}
