Limits 1s, 512 MB

String Matching is an important problem in computer science research and finds applications in data mining, pattern recognition, and many more areas.

The problem we consider here is a smaller version of it. You are given a set of strings. You have to find a string which all given strings are the substring of it.

A substring is a contiguous sequence of characters within a string. Such as "love" is a substring of "I love you".

In here there are no common characters between any two strings. And you should print the string so that substring of all given strings are a consecutive sequence.

Try to print the string so that the length is as minimum as possible.

Input

In the first line there is an integer N (1 ≤ N ≤ 25) which is the number of strings and the following N lines are the strings. The only characters that will occur are lowercase characters of English alphabet (‘a’-‘z’). String lengths will be less or equal to 26.

Output

Just print the string in a line.

Sample

InputOutput
2
a
b
ab

Submit

Login to submit.

Statistics

92% Solution Ratio
wajiulEarliest, Mar '20
wajiulFastest, 0.0s
wajiulLightest, 0 B
Nusab19Shortest, 37B
Toph uses cookies. By continuing you agree to our Cookie Policy.