Suffixes of one string#5916

Suffixes of one string

1 second
256 megabytes
Very easy

You are given a collection of strings: s_1, s_2, \ldots, s_n.

Your task is to find a string such that every given string is a suffix of .

Input

The first line contains an integer (1 \leq n \leq 10^5), representing the number of strings in the collection. Each of the next lines contains one string, where the -th line contains the non-empty string s_i.

All strings are composed solely of lowercase Latin letters. The combined length of all strings does not exceed 10^5.

Output

If such a string exists, print it. If there are multiple possible strings , print the one with the shortest length.

If no such string can be found, print -1.

Examples

Example 1

Loading
Loading