P6428 [COCI 2008/2009 #1] MRAVOJED

Description

Archaeologists have recently discovered the remains of Greek and Roman buildings. The site can be modeled as a grid of $r \times c$ square cells. For each cell, the archaeologists have determined whether there is a remain. After a detailed examination, they concluded that the site contains two buildings from different periods, and the floor plan of each building is a square. Since the buildings are from different periods, their floor plans may overlap. Determine the possible position and size (the side length of the square area it covers) for each building.

Input Format

The first line contains two integers $r$ and $c$, representing the number of rows and columns of the site. The next $r$ lines each contain $c$ characters. `.` means no remain is found in that cell, and `x` means a remain is found in that cell.

Output Format

For each building, output the coordinates of its top-left corner ($2$ numbers) and its side length ($1$ number). Separate every two numbers with a space.

Explanation/Hint

#### Hint The solution may not be unique. #### Constraints For $100\%$ of the testdata, a solution is guaranteed to exist, and $1 \leq r \leq 100,1 \leq c \leq 100$. #### Notes Translated from [COCI2008-2009](https://hsin.hr/coci/archive/2008_2009/) [CONTEST #1](https://hsin.hr/coci/archive/2008_2009/contest1_tasks.pdf) MRAVOJED. Translator: @[mnesia](https://www.luogu.com.cn/user/115711). #### Acknowledgements Thanks to @[y0y68](https://www.luogu.com.cn/user/115668) for providing the SPJ. Translated by ChatGPT 5