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.
from sys import stdin
from collections import defaultdict
from string import lowercase
def main():
    n = int(stdin.readline())
    s = [stdin.readline().strip() for _ in xrange(n)]
    e = defaultdict(set)
    re = defaultdict(set)
    c0 = ord('a')
    for x in s:
        for i in xrange(len(x) - 1):
            a, b = x[i], x[i+1]
            e[a].add(b)
            re[b].add(a)
    se = list(set(''.join(s)))
    se.sort()
    o = []
    st = []
    done = defaultdict(int)
    for c in se:
        if not done[c]:
            st.append(c)
            while st:
                x = st.pop()
                if not done[x]:
                    st.append(x)
                    done[x] = 1
                    for y in e[x]:
                        if not done[y]:
                            st.append(y)
                elif done[x] == 1:
                    done[x] = 2
                    o.append(x)
    g = defaultdict(int)
    done = defaultdict(int)
    k = 0
    for c in reversed(o):
        if not done[c]:
            st.append(c)
            while st:
                x = st.pop()
                g[x] = k
                if not done[x]:
                    st.append(x)
                    done[x] = 1
                    for y in re[x]:
                        if not done[y]:
                            st.append(y)
                elif done[x] == 1:
                    done[x] = 2
            k += 1
    for c in se:
        if c in e[c]:
            print "NO"
            return
        for d in se:
            if c != d and g[c] == g[d]:
                print "NO"
                return
    for c in se:
        if len(e[c]) > 1 or len(re[c]) > 1:
            print "NO"
            return
    r = []
    for c in se:
        if len(re[c]) == 0:
            x = c
            r.append(x)
            while e[x]:
                x = e[x].pop()
                r.append(x)
    print ''.join(r)
main()
