It's Cody's birthday! This year, instead of giving him a long string or an integer array with special properties, his friends surprised him with an interesting picture. Cody suspects that the image was cropped from a scene in a video he recently watched, but he can't remember the exact timestamp of the frame.
Cody has extracted all the frames in the video by FFmpeg, but he knows little about image matching. You, a helpful coder, decide to handle the task to earn an AC in return. Because the picture is stored in a lossy compression format, it is possible that an exact match cannot be found. The goal is to find a position with the smallest sum of squared difference (SSD) for the best match.
If the size of an image $$$I$$$ is $$$W \times H$$$ and the size of a (smaller) template image $$$T$$$ is $$$N \times M$$$, the SSD value of the position $$$(x, y)$$$ is defined as:
(a) $$$I$$$. (b) $$$T$$$. (c) Image difference. $$$\operatorname{SSD}(1,1) = 3^2 + 6^2 = 45$$$. The first line of the input contains two integers $$$W$$$ and $$$H$$$ — the width and the height of a frame from the video.
The following $$$H$$$ lines contain the description of the image $$$I$$$. Each line contains $$$W$$$ double-digit hexadecimal numbers — the pixels of the corresponding positions.
The next line of the input contains two integers $$$N$$$ and $$$M$$$ — the width and the height of the cropped image.
The following $$$M$$$ lines contain the description of the image $$$T$$$. Each line contains $$$N$$$ double-digit hexadecimal numbers — the pixels of the corresponding positions.
The best matching position $$$(x, y)$$$ $$$(0 \le x \le W - N,\ 0 \le y \le H - M)$$$.
If there are multiple such positions, print any of them.
3 200 FF 12AA BB 342 1FF 11
1 0
4 589 4E 72 C6C7 E9 EA 8F6E B1 FD E47C 22 6C D093 FB DB E53 379 C0 51B9 98 37BB 64 7F
1 0
4 314 59 EF A083 3E AE 9406 AA 0C 873 23E A8 94A7 0C 87
1 1
| Name |
|---|


