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.

XFIND - Find the cross

Given a black-and-white graphic encoded with 0 for black and 1 for white find the coordinates of the center of a white cross within. This means the intersection of a horizontal and vertical line of 1s. Each line reachs from border to border. There's at most one such cross. If there isn't a cross the output should be '0 0'.

Input

The number n of testcases (n<=50) in the first line.
Then for each testcase one line with the width w and heigth h (3<=w,h<=20) of the graphic separated by a space. After this h rows of each graphic.

Output

The space-separated coordinates x and y of the center of the white cross or '0 0'.

Example

Input:
2
4 3
0010
1111
0010
3 3
010
101
010 Output: 3 2
0 0

Added by:HWK
Date:2011-05-02
Time limit:7.892s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi

hide comments
2014-09-17 02:07:28 Piotr KÄ…kol
1000
1111
1000
2014-09-14 18:30:35 its_time_to_code
any tricky test case for which i'm getting W.A.
2014-03-09 13:18:32 weltfremd
Thanks for the quick answer :)

Never thought this would be considered a cross, since it has only 3 branches.
This should make it easier.
2014-03-08 20:49:49 Piotr KÄ…kol
There is no such test, but there are tests like:
1000
1000
1111
1000
...for which you print "0 0".
2014-03-08 17:53:37 weltfremd
Does anybody who knows care to share if the cross needs to be visible?

like

111
111
111

output is 0 0 or 2 2 ?

Or can someone tell me what's wrong with my "non"-solution? ;)
2013-12-22 04:06:47 Mitch Schwartz
Note: y=1 refers to the top row, not the bottom row.

(It explains some of my initial WAs/NZECs but not all of them -- I tried both variations while having a different bug, and also was testing the input for consistency.)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.