Non-prefix codes
Consider a set of n symbols {1, 2, ..., n}. Each symbol is associated with a vector b_i composed of 0s and 1s. For any sequence of these symbols, c = c_1c_2...c_k, you can form a vector of 0s and 1s by concatenating b_c1, b_c2, ..., b_ck, which we denote as B(c). Your task is to find the shortest vector X, consisting of 0s and 1s, such that X = B(c) and X = B(d) for two distinct ordered sequences c and d. If there are multiple such sequences, return the one that is smallest in lexicographical order. It is guaranteed that at least one such sequence exists.
Input
The first line of the input contains the number N (2 ≤ N ≤ 20). The following N lines each contain a vector b_i, with each vector having a length of at most 20.
Output
On the first line of the output, print the length of the sequence found. On the second line, print the sequence itself.