A console keeps a set of known command words. A command can be typed 'one character at a time' if every one of its non-empty proper prefixes is also a known command. (A single-letter command is always considered buildable, since it has no proper prefixes to require.)
Find the longest command that can be built one character at a time. If several commands of that maximum length qualify, choose the lexicographically smallest. If no command qualifies, print NONE.
The list may contain duplicates; treat it as a set. All commands consist of lowercase English letters only.
Input format
Line 1: an integer n.
Line 2: n space-separated command words.
Output format
A single line: the chosen command, or NONE.
Constraints
- 1 <= n <= 100000
- Each command has length 1..30, lowercase English letters.