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.
'''input
4
mail
ai
lru
cf
'''

import sys
pow2 = pow              # for modular expo pow2(base, n, mod)
from math import *
from time import time
from collections import defaultdict
from bisect import bisect_right, bisect_left
from string import ascii_lowercase as lcs
from string import ascii_uppercase as ucs
from fractions import Fraction, gcd
from decimal import Decimal, getcontext
from itertools import product, permutations, combinations
#getcontext().prec = 500
#sys.setrecursionlimit(30000)

# What doesn't challenge you, makes you weaker.

mod = 10**9 + 7
INF = sys.maxint

raw_input = lambda: sys.stdin.readline().rstrip()
die = lambda : exit(0)
flush= lambda : sys.stdout.flush()

r_s = lambda: raw_input().strip()                   #read str
r_ss = lambda: raw_input().split()          #read stringss
r_i = lambda: int(raw_input())              #read int
r_is = lambda: map(int, raw_input().split())#read ints
r_f = lambda: float(raw_input())            #read float
r_fs = lambda: map(Decimal, raw_input().split()) #read floats

# For effieciently taking lots of queries with each query in a separate line
# having integer values separated by space. A 2d list is made with each row
# corresponding to line. Each row is a list with all the values.
# Use this for fast I/O by taking all input in one go.
r_qs = lambda: map(lambda s:map(int, s.split(' ')), sys.stdin.readlines())

'''-------------------------------------------------------------------'''

# Call it as dbg(varName=varName)
def dbg(**kwargs):
    print "Value of '" + kwargs.keys()[0] + "' is", kwargs[kwargs.keys()[0]]

def main():
    n = r_i()
    words = []
    for i in range(n):
        words.append(r_s())
    # Directed graph with nodes as all the letters
    graph = defaultdict(list)
    graph2 = defaultdict(set)
    letters= set()
    for word in words:
        prev = word[0]
        letters.add(prev)
        for letter in word[1:]:
            letters.add(letter)
            if letter not in graph2[prev]:
                graph[prev].append(letter)
                graph2[prev].add(letter)
            prev = letter
    stack = [0 for i in range(26)]
    seen = set()
    start = [1 for i in range(26)]
    def dfs(root):
        if root in seen:
            return
        seen.add(root)
        stack[ord(root)-ord('a')] = 1
        for neigh in graph[root]:
            if stack[ord(neigh)-ord('a')]:
                print "NO"
                die()
            start[ord(neigh)-ord('a')] = 0
            dfs(neigh)
        stack[ord(root)-ord('a')] = 0

    for letter in letters:
        if letter not in seen:
            dfs(letter)
    for key in graph:
        graph[key].sort()
    # print graph
    starts  = []
    # print start
    for pos, letter in enumerate(start):
        if letter==1:
            starts.append(chr(pos+ord('a')))
    # print starts
    starts.sort()
    ans = []
    for letter in starts:
        if letter not in letters:
            continue
        temp = ''
        prev = letter
        while prev!='':
            new = prev
            temp += new
            letters.remove(new)
            if len(graph[new])>1:
                print "NO"
                die()
            for neigh in graph[new]:
                if neigh in letters:
                    prev = neigh
                    break
                else:
                    print "NO"
                    die()
            else:
                prev = ''
        ans.append(temp)
    ans.sort()
    ans = ''.join(ans)
    print ans




if __name__ == '__main__':
    # local = True
    local = False
    if local:
        try:
            sys.stdin = open('input.txt')
            print 'Running at local.'
            for i in range(r_i()):
                main()
        except IOError:
            main()
    else:
        main()


