IMGREC1 - Simple Image Recognition

no tags 

One of the hard problems that borrows human minds and can find the practical application in creating Artifical Intelegence is problem of Image Recognition. This problem in its simplest form can be applied in many spheres of manufactures. In given problem we interest in one elementary case of Image Recognition. You have to make choise form only two possible images that are represented on a bicoloured picture. This images is "dagger" or "zero". This images can be rotated, deformed, scaled, moved, have some noise or different width of lines on the picture. But human always can correctly define that is represented on a picture.

Input

t – number of test cases, than t test cases follows. [t <= 100]
[empty line]
Eache test case starts with integer N equals to number of pictures in this test, than N pictures follows. [4 <= N <= 10]
[empty line]
Description of each picture starts from two integers H and W - height and width of picture accordingly. [5 <= H, W <= 50]
than follows exactly H lines each consists of W chars.
Description of picture consists of two simbols only: 'x' - painted square and '.' - empty square. You can be assured, that no other symbols are present at the description of a picture.

Output

For each test it is necessary to deduce on a separate line a string of chars with length equals to N. The string should consist of a set of two chars 'x' and '0'. Where 'x' corresponds to a dagger on a picture, and '0' corresponds to a zero. If answer will contains other chars or length of a string won't equals to N you will receive status "Wrong Answer".

Score

The score awarded to your program is the sum of scores for individual test cases. The score for individual correctly solved test equals to N (Number of pictures in this test).

Example

Input:
1

5

5 5
x...x
.x.x.
..x..
.x.x.
x...x
5 5
xxxxx
x...x
x...x
x...x
xxxxx
6 6
..x...
..x...
xxxxxx
..x...
..x...
......
5 5
.xxx.
x...x
x...x
x...x
.xxx.
5 5
.xxx.
.x.x.
.xxx.
.....
.....
Output:
x0x00
Output:

You will recieve 5 points for this solution


hide comments
lrnn2cde: 2010-03-27 08:17:27

Can this figure be correct?

..xxxxx..
.........
..x...x..
.........
..xxxxx..

Last edit: 2010-04-01 14:31:10

Added by:Roman Sol
Date:2005-02-09
Time limit:21s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:ZCon 2005