Office Space

Office Space

Time Limit: 2.0 s

Memory Limit: 64.0 MB

So, Alice is starting a new company, and she is in the market for office space to rent for her company.

She decided to go with WoWerk, a commercial real estate company that provides shared workspaces for technology startups and services for other enterprises.

WoWerk, leases a building and sub-divides each floor to smaller section to rent it out to other companies.

She is expecting fast growth for her company, and so will need a large office space to accommodate future expansion.

Help her find the largest office space she can rent for each floor.

Input

Input starts with an integer T ( ≤ 10), denoting the number of floor.

Each case starts with a line containing two integers: m and n (1 ≤ m, n ≤ 2000). Each of the next m lines contains n characters (either 0 or 1) denoting floor or wall.

Output

For each floor, print the floor number and the maximum office space Alice could rent.

Sample Input

3
5 5
00010
10011
10110
01100
10011
5 5
10111
00011
01110
00110
11110
5 5
01000
11100
11101
00110
10000
3
5 5
11000
01000
00000
11011
11010
5 5
01111
01111
00101
01000
10011
5 5
11110
01011
11001
01100
00010
5
5 5
10111
01001
11011
11110
01101
5 5
11110
01011
10100
00001
00111
5 5
10101
11101
00110
01001
11000
5 5
10001
10001
11100
11100
11010
5 5
11101
10111
10011
01000
01110

Sample Output

Floor #1: 6
Floor #2: 7
Floor #3: 7
Floor #1: 14
Floor #2: 6
Floor #3: 6
Floor #1: 3
Floor #2: 9
Floor #3: 5
Floor #4: 11
Floor #5: 7

Information

ID
1002
Difficulty
4
Category
Graph_Theory | DFS , BFS Click to Show
Tags
(None)
# Submissions
31
Accepted
16
Accepted Ratio
52%
Uploaded By

Related

In following contests:

Beta Round #1