Task
Your friend, Ursu, gave a list of words only containing lowercase letters of the English alphabet. The list represents Ursu's phone book. Unfortunately, Ursu's phone book is quite long. That is why he would like you to help him rename all his contacts. Since both of you are quite lazy, you want to minimize the time spent renaming all the contacts. Now, Ursu asks you to find for each of the words the length of its shortest substring that does not appear in any of the other strings. If no such substring exists, Ursu would like to know that he cannot rename that contact, so, the answer will be considered to be .
Input
The first line of the input contains the number (). The next lines will each contain a string .
The total length of all the strings (noted ) will be at most
For tests worth points, .
For tests worth more points, .
Output
The program will print lines, the of them representing the length of the shortest substring of the string not appearing in any other string.
Example 1
stdin
3
abdf
abf
abde
stdout
2
2
1