#include <string>
#include <iostream>
#pragma warning(disable : 4996)
using namespace std;
int H, W, R, C; string s[1000], t[1000]; unsigned long long power[1001], h1[1000][1000], h2[1000];
int main() {
	scanf("%d%d", &H, &W);
	for (int i = 0; i < H; i++) cin >> s[i];
	scanf("%d%d", &R, &C);
	for (int i = 0; i < R; i++) cin >> t[i];
	power[0] = 1;
	for (int i = 1; i <= 1000; i++) power[i] = power[i - 1] * 257;
	for (int i = 0; i < H; i++) {
		unsigned long long val = 0;
		for (int j = 0; j < C; j++) val = val * 257 + s[i][j]; h1[i][0] = val;
		for (int j = C; j < W; j++) val = val * 257 + s[i][j] - power[C] * s[i][j - C], h1[i][j - C + 1] = val;
	}
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) h2[i] = h2[i] * 257 + t[i][j];
	}
	for (int i = 0; i <= H - R; i++) {
		for (int j = 0; j <= W - C; j++) {
			bool flag = true;
			for (int k = i; k < i + R; k++) {
				if (h1[k][j] != h2[k - i]) {
					flag = false; break;
				}
			}
			if (flag) {
				printf("%d %d\n", i, j);
			}
		}
	}
	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 <string>
#include <iostream>
#pragma warning(disable : 4996)
using namespace std;
int H, W, R, C; string s[1000], t[1000]; unsigned long long power[1001], h1[1000][1000], h2[1000];
int main() {
	scanf("%d%d", &H, &W);
	for (int i = 0; i < H; i++) cin >> s[i];
	scanf("%d%d", &R, &C);
	for (int i = 0; i < R; i++) cin >> t[i];
	power[0] = 1;
	for (int i = 1; i <= 1000; i++) power[i] = power[i - 1] * 257;
	for (int i = 0; i < H; i++) {
		unsigned long long val = 0;
		for (int j = 0; j < C; j++) val = val * 257 + s[i][j]; h1[i][0] = val;
		for (int j = C; j < W; j++) val = val * 257 + s[i][j] - power[C] * s[i][j - C], h1[i][j - C + 1] = val;
	}
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) h2[i] = h2[i] * 257 + t[i][j];
	}
	for (int i = 0; i <= H - R; i++) {
		for (int j = 0; j <= W - C; j++) {
			bool flag = true;
			for (int k = i; k < i + R; k++) {
				if (h1[k][j] != h2[k - i]) {
					flag = false; break;
				}
			}
			if (flag) {
				printf("%d %d\n", i, j);
			}
		}
	}
	return 0;
}
```