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;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vll = vector<ll>;
using pdd = pair<double, double>;
using vpdd = vector<pdd>;
template <typename T>
using uset = unordered_set<T>;
template <typename T>
using umultiset = unordered_multiset<T>;
template <typename K, typename V>
using umap = unordered_map<K, V>;
template <typename K, typename V>
using umultimap = unordered_multimap<K, V>;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, -1, 1};
const double eps = 1e-9;
const int INF = 0x7FFFFFFF;
const ll INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);
template <typename T>
T take(queue<T>& O) {
  T tmp = O.front();
  O.pop();
  return tmp;
}
template <typename T>
T take(stack<T>& O) {
  T tmp = O.top();
  O.pop();
  return tmp;
}
template <typename T>
T take(priority_queue<T>& O) {
  T tmp = O.top();
  O.pop();
  return tmp;
}
template <typename T>
inline bool inRange(const T& z, const T& a, const T& b) {
  return a <= z && z <= b;
}
void OPEN(const string& in = "input.txt", const string& out = "output.txt") {
  freopen(in.c_str(), "r", stdin);
  freopen(out.c_str(), "w", stdout);
  return;
}
const int N = 100005;
string s[N];
int n;
bitset<256> bs;
int _next[256], _prev[256];
void no() {
  cout << "NO\n";
  exit(0);
}
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int(i) = (0), _t = (n); i < (_t); ++(i)) {
    cin >> s[i];
    bs.reset();
    for (char c : s[i]) {
      if (bs.test(c)) {
        no();
      }
      bs.set(c, 1);
    }
  }
  memset(_next, -1, sizeof(_next));
  memset(_prev, -1, sizeof(_prev));
  bs.reset();
  for (int(i) = (0), _t = (n); i < (_t); ++(i)) {
    const string& s = ::s[i];
    char lst = 0;
    for (char c : s) {
      if (lst) {
        bool ok = (_next[lst] == -1 || _next[lst] == c);
        ok &= (_prev[c] == -1 || _prev[c] == lst);
        if (!ok) {
          no();
        }
        _next[lst] = c;
        _prev[c] = lst;
      }
      lst = c;
      bs.set(c, 1);
    }
  }
  priority_queue<char, vector<char>, greater<char>> pq;
  for (int(c) = ('a'), _t = ('z'); c <= (_t); ++(c)) {
    if (bs.test(c) && _prev[c] == -1) {
      pq.push(c);
    }
  }
  string result = "";
  while (!pq.empty()) {
    int now = pq.top();
    pq.pop();
    do {
      result.push_back((char)now);
      now = _next[now];
    } while (now != -1);
  }
  if ((int)result.size() != bs.count()) no();
  cout << result << "\n";
}
