Line analysis
In the development of algorithms and systems for internet search, parsing expressions is a crucial component. Over the years, numerous algorithms have been created to tackle this task, each varying in execution time, complexity, and resource usage.
Let's examine the problem of determining if a given string is composed of words from a specific dictionary. A straightforward approach to solve this is the greedy algorithm. This method repeatedly removes the longest prefix of the string that matches a word in the dictionary. On a large set of strings formed by concatenating dictionary words, this algorithm effectively splits the string into words and is easy to implement. However, it can fail on certain strings. For instance, with a dictionary containing all English words, the string "workingrass" will be incorrectly parsed. The algorithm will first remove the prefix "working", leaving "rass", which cannot be split further. Yet, the string can be correctly split into "work", "in", and "grass".
In some applications, the dictionary may not be in English and could be quite specific, allowing the algorithm to correctly split all possible concatenations of dictionary words. Your task is to determine if the dictionary is such that the algorithm works perfectly. If not, provide an example of a string that can be split into dictionary words but is not correctly parsed by the algorithm. If multiple examples exist, find the shortest one. If there are several shortest examples, you can output any one.
Input
The first line contains a single integer n (1 ≤ n ≤ 250), representing the number of words in the dictionary. The following n lines list the words in the dictionary. Each word is non-empty, consists only of lowercase Latin letters, and does not exceed 500 characters in length.
Output
If there are strings that meet the criteria described, output any one of them with the shortest length. The string should consist only of lowercase Latin letters. If no such strings exist, output "Good vocabulary!".