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.
#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  if (n < 2) return 0;
  if (n < 4) return 1;
  if (n % 2 == 0 or n % 3 == 0) return 0;
  for (long long i = 5; i * i <= n; i += 6)
    if (n % i == 0 or n % (i + 2) == 0) return 0;
  return 1;
}
long long modexpo(long long x, long long p) {
  long long res = 1;
  x = x % 1000000007;
  while (p) {
    if (p % 2) res = res * x;
    p >>= 1;
    x = x * x % 1000000007;
    res %= 1000000007;
  }
  return res;
}
long long max(long long a, long long b) { return (a > b ? a : b); }
long long min(long long a, long long b) { return (a < b ? a : b); }
struct edge {
  long long u, v, w;
  edge(long long a, long long b, long long c) {
    u = a;
    v = b;
    w = c;
  }
};
struct node {
  long long u, v, w;
  node(long long a, long long b, long long c) {
    u = a;
    v = b;
    w = c;
  }
};
struct compare {
  bool operator()(const edge a, const edge b) { return a.w < b.w; }
  bool operator()(const pair<long long, long long> a,
                  const pair<long long, long long> b) const {
    return a.first > b.first;
  }
  bool operator()(const node a, const node b) const {
    if (a.u == b.u) {
      if (a.w == b.w) {
        return a.v < b.v;
      }
      return a.w < b.w;
    }
    return a.u < b.u;
  }
};
const long long N = 30;
set<long long> g[N], rg[N];
long long present[N];
long long n;
string a[100005];
string ans = "";
void dfs(long long x) {
  present[x] = 0;
  ans += (char)(x + 'a');
  for (long long i : g[x]) {
    dfs(i);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long len = a[i].length();
    for (long long j = 0; j < len - 1; j++) {
      g[a[i][j] - 'a'].insert(a[i][j + 1] - 'a');
      rg[a[i][j + 1] - 'a'].insert(a[i][j] - 'a');
    }
    for (long long j = 0; j < len; j++) {
      present[a[i][j] - 'a'] = 1;
    }
  }
  for (long long i = 0; i < 26; i++) {
    if (g[i].size() > 1 || rg[i].size() > 1) {
      cout << "NO"
           << "\n";
      exit(0);
    }
  }
  for (long long i = 0; i < 26; i++) {
    if (rg[i].size() == 0 && present[i]) {
      dfs(i);
    }
  }
  for (long long i = 0; i < 26; i++) {
    if (present[i]) {
      cout << "NO"
           << "\n";
      exit(0);
    }
  }
  cout << ans << "\n";
}
