A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.

You are given a set of strings. A string (not necessarily from this set) is called good if all elements of the set are the most frequent substrings of this string. Restore the non-empty good string with minimum length. If several such strings exist, restore lexicographically minimum string. If there are no good strings, print "NO" (without quotes).

A substring of a string is a contiguous subsequence of letters in the string. For example, "ab", "c", "abc" are substrings of string "abc", while "ac" is not a substring of that string.

The number of occurrences of a substring in a string is the number of starting positions in the string where the substring occurs. These occurrences could overlap.

String a is lexicographically smaller than string b, if a is a prefix of b, or a has a smaller letter at the first position where a and b differ.

Input

The first line contains integer n (1 ≤ n ≤ 105) — the number of strings in the set.

Each of the next n lines contains a non-empty string consisting of lowercase English letters. It is guaranteed that the strings are distinct.

The total length of the strings doesn't exceed 105.

Output

Print the non-empty good string with minimum length. If several good strings exist, print lexicographically minimum among them. Print "NO" (without quotes) if there are no good strings.

Examples

Input

4
mail
ai
lru
cf


Output

cfmailru


Input

3
kek
preceq
cheburek


Output

NO

Note

One can show that in the first sample only two good strings with minimum length exist: "cfmailru" and "mailrucf". The first string is lexicographically minimum.
n = int(input())
A = []
for i in range (0,n):
    A = A + [input()]
start = [100]*26
end = [100]*26
def num(x):
    return(ord(x)-ord("a"))
def let(x):
    return(chr(x+ord("a")))
def ans(x):
    final = []
    for i in range (0,n):
        B = list(A[i])
        if len(B) == 1:
            if start[num(B[0])] == 100:
                start[num(B[0])] = -100
            if end[num(B[0])] == 100:
                end[num(B[0])] = -100
        else:
            for j in range (0,len(B)):
                if j==0:
                    if start[num(B[j])] == 100 or start[num(B[j])] == -100:
                        start[num(B[j])] = -100
                    if end[num(B[j])] == 100 or end[num(B[j])] == -100:
                        end[num(B[j])] = num(B[j+1])
                    elif end[num(B[j])] == num(B[j+1]): g=0
                    else:
                        return("NO")
                elif 0<j<len(B)-1:
                    if start[num(B[j])] == 100 or start[num(B[j])] == -100:
                        start[num(B[j])] = num(B[j-1])
                    elif start[num(B[j])] != num(B[j-1]):
                        return("NO")
                    if end[num(B[j])] == 100 or end[num(B[j])] == -100:
                        end[num(B[j])] = num(B[j+1])
                    elif end[num(B[j])] != num(B[j+1]):
                        return("NO")
                elif j == len(B)-1:
                    if end[num(B[j])] == 100:
                        end[num(B[j])] = -100
                    if start[num(B[j])] == 100 or start[num(B[j])] == -100:
                        start[num(B[j])] = num(B[j-1])
                    elif start[num(B[j])] == num(B[j-1]): g=0
                    else:
                        return("NO")
    if len(set(start))+max(0,start.count(100)-1)+max(0,start.count(-100)-1) != 26:
            return("NO")
    elif len(set(end))+max(0,end.count(100)-1)+max(0,end.count(-100)-1) != 26:
            return("NO")
    else:
        for i in range (0,26):
            if start[i] != -100:
                g=0
            else:
                final = final + [let(i)]
                j = end[i]
                while j != -100:
                    final = final + [let(j)]
                    j = end[j]
        if len(final) != len(set(start))-min(1,start.count(100))+max(0,start.count(-100)-1):
            return("NO")
        else:
            return("".join(final))
print(ans(A))