Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

Problem hidden on 2012-03-21 12:57:17 by [Trichromatic] XilinX

SUMOF - Borders

no tags 

Once Vasya fell into the hands of a piece of graph paper the size of n × m cells. Our Bob likes geometric shapes, and so he drew on a piece of two rectangles with sides parallel to coordinate axes, the length of each side of each rectangle not less than three cells, and the parties themselves have drawn lines between the cells (as the parties may be part of the boundary of the leaf paper). Bob then all cells on the shaded part of the rectangles.

Rectangular frame is the set of cells within a rectangle having at least one common side with its boundary.

Some time later, Bob found a piece of paper the same size, and could not understand, the same piece of it. So he asked you to check whether it was true that they found a piece of paper painted with two frames, and nothing but them.

Please note that Vasya painted frame can intersect, overlap in an arbitrary way, and perhaps even the same.

Coordinates on a piece introduced so that the X-axis goes from top to bottom, x-coordinates of the cell numbers range from 1 to n, and the Y axis goes from left to right, and y-coordinates of the cells range from 1 to m.


The first line of input contains two integers n and m (3 ≤ n, m ≤ 1000) - the size of the leaf found. The following n lines, each consisting of m symbols "." (Point) and "#" (pound), describe the found piece of paper. The symbol "#" refers to the shaded cell, the symbol "." - Unshaded.


Output in the first line of a single word «YES» or «NO», meaning whether it is true that the results painted a piece of two frames. If yes to the second line of output four integers: the upper left and lower right corners of the first frame, and in the third row - four integers: the upper left and lower right corners of the second frame. If you answer a few, any output.


4 5


1 1 3 3
1 1 4 5

hide comments
jogendra singh: 2013-08-21 23:12:33

. zx zxc/., ,

:D: 2012-03-21 11:09:41

I would guess that the big number of WA's is caused by lack of custom judge. If that's the case please hide it!

Added by:Azat Taryhchiyev
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64