Gold Leaf

No attempts yetTime limit5sMemory limit256 MB

Problem

Gold leaf is a very thin layer of gold with a paper backing. If the paper gets folded and then unfolded, the gold sticks to itself more readily than it sticks to the paper, so patches of gold and patches of bare paper appear. The gold always ends up on one side of the fold, never on both.

In the picture below, the paper was folded along the dashed line.

You are given a crude digital image of a sheet of gold leaf. A pixel whose area is mostly gold is written as #, and a pixel whose area is mostly bare paper is written as .. Find where the sheet was folded.

The sheet was folded exactly once, along a horizontal line, a vertical line, or a 45 degree diagonal line. A horizontal or vertical fold always runs between two rows or between two columns. A diagonal fold runs through a diagonal line of cells, and every cell on the fold is #. Of two cells that meet each other when the paper is folded, exactly one is #, and a cell that meets no other cell keeps its gold and is #.

Input

The first line contains the number of test cases TT (1T1001 \le T \le 100).

Each test case starts with a line containing two integers NN and MM (2N,M252 \le N, M \le 25), where NN is the number of rows and MM is the number of columns of the photograph. Each of the next NN lines contains exactly MM characters, each of which is # or .. At least one . appears, and a fold that explains the image always exists.

Output

For each test case, print four integers r1r_1 c1c_1 r2r_2 c2c_2 on one line, giving the two places where the fold hits the edges of the paper. Here rr is a row and cc is a column, the top left character is (1,1)(1, 1), and the bottom right character is (N,M)(N, M).

For a horizontal or diagonal fold, print the left coordinates before the right ones. For a vertical fold, print the top coordinates before the bottom ones. For a horizontal fold, use the coordinates above the fold. For a vertical fold, use the coordinates to the left of the fold. For a diagonal fold, use the coordinates of the cells that the fold runs through. If more than one fold is possible, choose the one with the smallest first coordinate, then the smallest second coordinate, then the third, then the fourth.