Although the program committee works as one team, heated debates arise frequently enough. For example, there is no agreement upon which client of the version control system is more convenient to use: a graphic interface program or a console client.
Let us consider some command of a console client. A substring of this command that is not a substring of any other command of this client can be called a key substring because it uniquely identifies the command. In the latest versions of the client, it is not necessary to type the whole command; it is sufficient to type any of its key substrings.
A supporter of the console client wants to convince the program committee to use it. In order to show how fast and convenient the work with this client is, he wants to find a key substring of minimal length for each command. Help him do it.
The first line contains the number n of commands in the console client
(2 ≤ n ≤ 1000). Each of the following n lines contains one command of the client. Each command is a nonempty string consisting of lowercase Latin letters and its length is at most 100. No command is a substring of another command.
Output n lines. The i-th line should contain any of the shortest
key substrings of the i-th command (the commands are numbered in the order
they are given in the input).
Problem Author: Dmitry Ivankov (idea by Alexander Mironenko)
Problem Source: NEERC 2009, Eastern subregional contest