eolymp
bolt
Try our new interface for solving problems
Problems

Image and Shadow

Image and Shadow

In order to make machine recognition of characters more difficult in the "\textbf{CAPTCHA}" (\textbf{C}ompletely \textbf{A}utomated \textbf{P}ublic \textbf{T}uring test to tell \textbf{C}omputers and \textbf{H}umans \textbf{A}part) system different transformation are used. One of these transformations is the "fall of the shadow" -- the symbol is shifted and imposed on itself. For example, the picture below shows the process of falling the shadow with the letter "\textbf{S}" for an \textbf{8}×\textbf{8} image. \includegraphics{https://static.e-olymp.com/content/fd/fdb2a41aa92c12a00236c137a717a77f0331c047.jpg} Let us have an \textbf{16}×\textbf{16} image. We take as the origin the upper left corner and we measure the horizontal \textbf{x} coordinate axis from the left to right and the vertical \textbf{y} coordinate axis top-down. We denote by (\textbf{x}, \textbf{y}) vector, on which the image was shifted, and call it the shift vector. In the picture above, the shift vector is (\textbf{3}, \textbf{1}) -- image was shifted by \textbf{3} points to the right and one to the down. The original picture without imposed shadow is called the image and the modified image -- image with shadow. We also agree that in the process of applying shadows, the shift vector is chosen in such way that shaded (black) point of the image does not fall outside the square \textbf{16}×\textbf{16}. Your task is to write a program that performs the inverse transformation: according to the image with the shadow find the image and the shift vector with the minimal numbers of shaded (black) points in the image. If there are several such images, the answer would be any of them. \textit{\textbf{Limitations}}. Shift vector is limited so that black point of the image does not extend beyond the square \textbf{16}×\textbf{16}. \textbf{-15} ≤ \textbf{x}, \textbf{y} ≤ \textbf{15}. \InputFile The input file contains an image with a shadow, and consists of \textbf{16} rows, each of which contains exactly \textbf{16} characters. Blank (white) point is denoted by "\textbf{.}" (ASCII = 2Eh), shaded point is denoted by "\textbf{#}" (ASCII = 23h). \OutputFile The first line of the output file should contain two integers \textbf{x} and \textbf{y} (shift vector), separated by the space. Then \textbf{16} lines of \textbf{16} characters each should follow -- the image encoded in the same way as in the input file.
Time limit 1 second
Memory limit 64 MiB
Input example #1
.###............
#...###.........
#..#...#........
.###............
....###.........
#...#..#........
.###...#........
....###.........
................
................
................
................
................
................
................
................
Output example #1
3 1
.###............
#...#...........
#...............
.###............
....#...........
#...#...........
.###............
................
................
................
................
................
................
................
................
................