The input is a series of distance matrices, followed by a line consisting of a single '0'. Each distance matrix is formatted as follows.
N
a11 a12 ... a1N
a21 a22 ... a2N
...
...
...
...
aN1 aN2 ... aNN
N is the size, i.e. the number of rows and the number of columns, of the matrix. aij gives the distance between the i-th leaf node (computer) and the j-th. You may assume 2 <= N <= 50 and the matrix is symmetric whose diagonal elements are all zeros. That is, aii = 0 and aij = aji for each i and j. Each non-diagonal element aij (i != j) satisfies 2 <= aij <= 30. You may assume there is always a solution. That is, there is a tree having the given distances between leaf nodes.