e-olymp
Problems

Maximum Clique

Maximum Clique

Given a graph G(V, E), a clique is a sub-graph g(v, e), so that for all vertex pairs v1, v2 in v, there exists an edge (v1, v2) in e. Maximum clique is the clique that has maximum number of vertex.

Input

Consists of multiple tests. The first line of each test case contains the number of vertices n (1 < n50). The following n lines has n numbers 0 or 1 each, indicating whether an edge exists between i (line number) and j (column number). The last line contains n = 0 and must not be processed.

Output

For each test case print on a separate line the number of vertices in maximum clique.

Time limit 2 seconds
Memory limit 128 MiB
Input example #1
5
0 1 1 0 1
1 0 1 1 1
1 1 0 1 1
0 1 1 0 1
1 1 1 1 0
0
Output example #1
4