Weak Number Recognition

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 2221
64-bit integer IO format: %I64d      Java class name: Main

Description

Wiskey wants to develop an image retrieval system, but he can’t deal with the number recognition.

The number is neat which no any aliasing, no any redundant point, and made by ‘#’.
You can use the software “ASCII Art Studio”, the data come from there.

The font is Arial, and the font size between “五号” and “一号", the style is bold.
The data is weak, not all of the numbers which various sizes are need to be recognized.
Come on baby; please improve your program as much as possible.

Input

First line will contain one integer mean how many cases will follow by.
In each case will contain two integers N, M mean the N*M matrix will follow. (10 <= N, M <= 26)

Output

Print which number did you recognized.

Sample Input

2
10 7
  ###  
 ##### 
### ###
##   ##
##   ##
##   ##
##   ##
### ###
 ##### 
  ###  
14 9
  #####  
 ####### 
###   ###
###   ###
###   ###
 ### ### 
  #####  
  #####  
 ### ### 
###   ###
###   ###
###   ###
 ####### 
  #####

Sample Output

0
8
Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .