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;
void fail() {
  cout << "NO" << endl;
  exit(0);
}
template <typename T>
struct UnionFindWeight {
  vector<int> par;
  vector<int> sz;
  vector<T> W;
  function<T(T, T)> merge;
  function<T(T)> inv;
  UnionFindWeight(int n, function<T(T, T)> merge, function<T(T)> inv)
      : merge(merge), inv(inv) {
    if (n > 0) initialize(n);
  }
  void initialize(int n) {
    par.resize(n);
    sz.resize(n, 1);
    W.resize(n);
    for (int i = 0; i < n; i++) {
      par[i] = i;
    }
  }
  int find(int x) {
    if (par[x] == x) {
      return x;
    } else {
      int r = find(par[x]);
      W[x] = merge(W[x], W[par[x]]);
      return par[x] = r;
    }
  }
  void unite(int x, int y, T w) {
    w = merge(w, inv(weight(x)));
    w = merge(w, weight(y));
    x = find(x);
    y = find(y);
    if (x == y) {
      if (weight(x) - weight(y) != w) fail();
      return;
    }
    if (sz[x] > sz[y]) {
      swap(x, y);
      w = inv(w);
    }
    par[x] = y;
    sz[y] += sz[x];
    W[x] = merge(W[x], w);
  }
  T weight(int x) {
    find(x);
    return W[x];
  }
  T diff(int x, int y) { return merge(weight(x), inv(weight(y))); }
  bool same(int x, int y) { return find(x) == find(y); }
};
int main() {
  int N;
  cin >> N;
  UnionFindWeight<int> uf(
      300, [](int a, int b) { return a + b; }, [](int a) { return -a; });
  vector<string> ss(N);
  for (int i = 0; i < N; i++) cin >> ss[i];
  bitset<300> used;
  for (auto& s : ss) {
    int sz = s.size();
    for (int i = 0; i < sz; i++) {
      used[s[i]] = 1;
      uf.unite(s[i], s[0], i);
    }
  }
  vector<string> parts;
  for (char c = 'a'; c <= 'z'; c++)
    if (used[c] && uf.find(c) == c) {
      string S(uf.sz[c], '!');
      char tp = c;
      for (char a = 'a'; a <= 'z'; a++)
        if (uf.find(a) == c && uf.diff(a, c) < uf.diff(tp, c)) tp = a;
      for (char a = 'a'; a <= 'z'; a++)
        if (uf.find(a) == c) {
          int pos = uf.diff(a, tp);
          if (S[pos] != '!') fail();
          S[pos] = a;
        }
      parts.push_back(S);
    }
  sort(parts.begin(), parts.end());
  string ans;
  for (auto& s : parts) ans += s;
  cout << ans << endl;
  return 0;
}
