The package for this problem was not updated by the problem writer or Codeforces administration after we've upgraded the judging servers. To adjust the time limit constraint, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
B. Two Tables

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou've got two rectangular tables with sizes *n*_{a} × *m*_{a} and *n*_{b} × *m*_{b} cells. The tables consist of zeroes and ones. We will consider the rows and columns of both tables indexed starting from 1. Then we will define the element of the first table, located at the intersection of the *i*-th row and the *j*-th column, as *a*_{i, j}; we will define the element of the second table, located at the intersection of the *i*-th row and the *j*-th column, as *b*_{i, j}.

We will call the pair of integers (*x*, *y*) a shift of the second table relative to the first one. We'll call the overlap factor of the shift (*x*, *y*) value:

where the variables *i*, *j* take only such values, in which the expression *a*_{i, j}·*b*_{i + x, j + y} makes sense. More formally, inequalities 1 ≤ *i* ≤ *n*_{a}, 1 ≤ *j* ≤ *m*_{a}, 1 ≤ *i* + *x* ≤ *n*_{b}, 1 ≤ *j* + *y* ≤ *m*_{b} must hold. If there are no values of variables *i*, *j*, that satisfy the given inequalities, the value of the sum is considered equal to 0.

Your task is to find the shift with the maximum overlap factor among all possible shifts.

Input

The first line contains two space-separated integers *n*_{a}, *m*_{a} (1 ≤ *n*_{a}, *m*_{a} ≤ 50) — the number of rows and columns in the first table. Then *n*_{a} lines contain *m*_{a} characters each — the elements of the first table. Each character is either a "0", or a "1".

The next line contains two space-separated integers *n*_{b}, *m*_{b} (1 ≤ *n*_{b}, *m*_{b} ≤ 50) — the number of rows and columns in the second table. Then follow the elements of the second table in the format, similar to the first table.

It is guaranteed that the first table has at least one number "1". It is guaranteed that the second table has at least one number "1".

Output

Print two space-separated integers *x*, *y* (|*x*|, |*y*| ≤ 10^{9}) — a shift with maximum overlap factor. If there are multiple solutions, print any of them.

Examples

Input

3 2

01

10

00

2 3

001

111

Output

0 1

Input

3 3

000

010

000

1 1

1

Output

-1 -1

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/06/2023 09:41:16 (g2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|