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;
const int maxn = (1e6) + 7;
const int inf = (1e9) + 7;
const long long LLinf = (1e18) + 7;
const long double eps = 1e-9;
const long long mod = 1e9 + 7;
string s[maxn];
string c[5];
bool vis[maxn];
bool wyl[maxn];
set<int> V[maxn];
int ile[maxn];
void koniec() {
  cout << "NO\n";
  exit(0);
}
inline void czy(string a, string b) {
  if (((int)(b).size()) > ((int)(a).size())) swap(a, b);
  int wsk = ((int)(a).size()) - ((int)(b).size());
  for (int i = 0; i < ((int)(b).size()); i++)
    if (b[i] != a[wsk + i]) koniec();
}
inline void spr(string a, string b) {
  for (int i = 0; i < min(((int)(a).size()), ((int)(b).size())); i++)
    if (a[i] != b[i]) koniec();
}
inline void usun(int x) {
  for (auto v : s[x]) V[(int)v].erase(x);
}
inline void merge(int a, int b, char litera) {
  if (wyl[a] || wyl[b]) return;
  for (int i = 0; i < 5; i++) c[i] = "";
  int f = 0;
  for (int i = 0; i < ((int)(s[a]).size()); i++) {
    c[f].push_back(s[a][i]);
    if (s[a][i] == litera) {
      f = 1;
      c[f].push_back(s[a][i]);
    }
  }
  f = 2;
  for (int i = 0; i < ((int)(s[b]).size()); i++) {
    c[f].push_back(s[b][i]);
    if (s[b][i] == litera) {
      f = 3;
      c[f].push_back(s[b][i]);
    }
  }
  czy(c[0], c[2]);
  spr(c[1], c[3]);
  if (((int)(c[0]).size()) > ((int)(c[2]).size())) swap(c[0], c[2]);
  s[a] = c[2];
  s[a].pop_back();
  if (((int)(c[1]).size()) > ((int)(c[3]).size())) swap(c[1], c[3]);
  s[a] += c[3];
  for (int i = 'a'; i < 'z' + 1; i++) ile[i] = 0;
  for (auto v : s[a]) {
    ile[(int)v]++;
    if (ile[(int)v] > 1) koniec();
  }
  for (auto v : s[(int)a]) V[(int)v].insert(a);
  usun(b);
  wyl[b] = 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (auto v : s[i])
      if (V[(int)v].count(i))
        koniec();
      else
        V[(int)v].insert(i);
  }
  for (int i = 'a'; i < 'z' + 1; i++) {
    while (((int)(V[(int)i]).size()) > 1) {
      auto it = V[(int)i].begin();
      it++;
      merge(*V[(int)i].begin(), *it, (char)i);
    }
  }
  vector<string> wek;
  for (int i = 'a'; i < 'z' + 1; i++)
    if (((int)(V[i]).size())) {
      int kto = *V[i].begin();
      if (vis[kto] == 1) continue;
      wek.push_back(s[kto]);
      vis[kto] = 1;
    }
  sort(wek.begin(), wek.end());
  for (auto v : wek) cout << v;
  return 0;
}
