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;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
vector<set<int> > g;
vector<set<int> > rev;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<string> a(n);
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  g.resize(27);
  rev.resize(27);
  set<int> st;
  bool ng = 0;
  for (int i = 0; i < (int)(n); ++i) {
    int m = a[i].size();
    set<int> ss;
    for (int j = 0; j < (int)(m - 1); ++j) {
      int c = a[i][j] - 'a';
      int d = a[i][j + 1] - 'a';
      g[c].insert(d);
      rev[d].insert(c);
      st.insert(c);
      st.insert(d);
      if (ss.count(c) != 0 || ss.count(d) != 0) {
        ng = 1;
      }
      ss.insert(c);
      if (c == d) ng = 1;
    }
    st.insert(a[i][m - 1] - 'a');
    if (ss.count(a[i][m - 1] - 'a') != 0) {
      ng = 1;
    }
  }
  for (int i = 0; i < (int)(26); ++i) {
    if (g[i].size() >= 2 || rev[i].size() >= 2) {
      ng = 1;
    }
  }
  if (ng) {
    cout << "NO" << endl;
    return 0;
  }
  vector<string> res;
  for (int i = 0; i < (int)(26); ++i) {
    if (st.count(i) == 1) {
      int cnt = 0;
      int dd = i;
      while (rev[dd].size() != 0) {
        dd = *rev[dd].begin();
        cnt++;
        if (cnt > 30) break;
      }
      if (cnt > 30) {
        ng = 1;
        break;
      }
      if (rev[i].size() == 0) {
        int id = i;
        string tmp;
        while (g[id].size() != 0) {
          tmp.push_back('a' + id);
          id = *g[id].begin();
        }
        tmp.push_back('a' + id);
        res.push_back(tmp);
      }
    }
  }
  if (ng) {
    cout << "NO" << endl;
    return 0;
  }
  sort(res.begin(), res.end());
  for (auto x : res) {
    cout << x;
  }
  cout << endl;
  return 0;
}
