atcoder#ABC269B. [ABC269B] Rectangle Detection

[ABC269B] Rectangle Detection

Score : 200200 points

Problem Statement

Takahashi generated 1010 strings S1,S2,,S10S_1,S_2,\dots,S_{10} as follows.

  • First, let Si(1i10)=S_i (1 \le i \le 10)= .......... (1010 .s in a row).
  • Next, choose four integers AA, BB, CC, and DD satisfying all of the following.- 1AB101 \le A \le B \le 10.
    • 1CD101 \le C \le D \le 10.
  • 1AB101 \le A \le B \le 10.
  • 1CD101 \le C \le D \le 10.
  • Then, for every pair of integers (i,j)(i,j) satisfying all of the following, replace the jj-th character of SiS_i with #.- AiBA \le i \le B.
    • CjDC \le j \le D.
  • AiBA \le i \le B.
  • CjDC \le j \le D.

You are given S1,S2,,S10S_1,S_2,\dots,S_{10} generated as above. Find the integers AA, BB, CC, and DD Takahashi chose. It can be proved that such integers AA, BB, CC, and DD uniquely exist (there is just one answer) under the Constraints.

Constraints

  • S1,S2,,S10S_1,S_2,\dots,S_{10} are strings, each of length 1010, that can be generated according to the Problem Statement.

Input

The input is given from Standard Input in the following format:

S1S_1

S2S_2

\vdots

S10S_{10}

Output

Print the answer in the following format:

AA BB

CC DD

..........
..........
..........
..........
...######.
...######.
...######.
...######.
..........
..........
5 8
4 9

Here, Takahashi chose A=5A=5, B=8B=8, C=4C=4, D=9D=9. This choice generates 1010 strings S1,S2,,S10S_1,S_2,\dots,S_{10}, each of length 1010, where the 44-th through 99-th characters of S5,S6,S7,S8S_5,S_6,S_7,S_8 are #, and the other characters are .. These are equal to the strings given in the input.

..........
..#.......
..........
..........
..........
..........
..........
..........
..........
..........
2 2
3 3
##########
##########
##########
##########
##########
##########
##########
##########
##########
##########
1 10
1 10