#include<iostream>
using namespace std;
#define MOD 100000000000007LL
long long dp[1001][1001];
long long x[1001][1001];
long long y[1001][1001];
long long z[1001];
long long H, W, N, M;
long long modpow[1001];
int main() {
	modpow[0] = 1;
	for (int i = 1; i <= 1000; i++) {
		modpow[i] = modpow[i - 1] * 256;
		modpow[i] %= MOD;
	}
	cin >> H >> W; unsigned char c;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> c; x[i][j] = c;
		}
	}
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		long long sum = 0;
		for (int j = 0; j < M; j++) {
			cin >> c; y[i][j] = c;
			sum *= 256; sum %= MOD;
			sum += y[i][j];
		}
		z[i] = sum;
	}
	for (int i = 0; i < H; i++) {
		long long sum = 0;
		for (int j = 0; j < M; j++) {
			sum *= 256; sum %= MOD;
			sum += x[i][j];
		}
		dp[i][0] = sum;
		for (int j = M; j < W; j++) {
			dp[i][j - M + 1] = dp[i][j - M];
			dp[i][j - M + 1] += MOD * 256 - modpow[M - 1] * x[i][j - M];
			dp[i][j - M + 1] *= 256;
			dp[i][j - M + 1] %= MOD;
			dp[i][j - M + 1] += x[i][j];
		}
	}
	for (int i = 0; i <= H - N; i++) {
		for (int j = 0; j <= W - M; j++) {
			for (int k = 0; k < N; k++) {
				if (dp[i + k][j] != z[k]) { goto E; }
			}
			cout << i << ' ' << j << endl;
		E:;
		}
	}
	return 0;
}
### Prompt

Your task is to create a CPP solution to the following problem:

Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.

Constraints

* 1 ≤ H, W ≤ 1000
* 1 ≤ R, C ≤ 1000
* The input consists of alphabetical characters and digits

Input

In the first line, two integers H and W are given. In the following H lines, i-th lines of the region are given.

In the next line, two integers R and C are given. In the following R lines, i-th lines of the pattern are given.

Example

Input

4 5
00010
00101
00010
00100
3 2
10
01
10


Output

0 3
1 2

### Response

```cpp
#include<iostream>
using namespace std;
#define MOD 100000000000007LL
long long dp[1001][1001];
long long x[1001][1001];
long long y[1001][1001];
long long z[1001];
long long H, W, N, M;
long long modpow[1001];
int main() {
	modpow[0] = 1;
	for (int i = 1; i <= 1000; i++) {
		modpow[i] = modpow[i - 1] * 256;
		modpow[i] %= MOD;
	}
	cin >> H >> W; unsigned char c;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> c; x[i][j] = c;
		}
	}
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		long long sum = 0;
		for (int j = 0; j < M; j++) {
			cin >> c; y[i][j] = c;
			sum *= 256; sum %= MOD;
			sum += y[i][j];
		}
		z[i] = sum;
	}
	for (int i = 0; i < H; i++) {
		long long sum = 0;
		for (int j = 0; j < M; j++) {
			sum *= 256; sum %= MOD;
			sum += x[i][j];
		}
		dp[i][0] = sum;
		for (int j = M; j < W; j++) {
			dp[i][j - M + 1] = dp[i][j - M];
			dp[i][j - M + 1] += MOD * 256 - modpow[M - 1] * x[i][j - M];
			dp[i][j - M + 1] *= 256;
			dp[i][j - M + 1] %= MOD;
			dp[i][j - M + 1] += x[i][j];
		}
	}
	for (int i = 0; i <= H - N; i++) {
		for (int j = 0; j <= W - M; j++) {
			for (int k = 0; k < N; k++) {
				if (dp[i + k][j] != z[k]) { goto E; }
			}
			cout << i << ' ' << j << endl;
		E:;
		}
	}
	return 0;
}
```