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 ri(int &a) {
  a = 0;
  register int x = getchar_unlocked();
  bool neg = false;
  while (x < '0' || x > '9') {
    if (x == '-') neg = true;
    x = getchar_unlocked();
  }
  while (x >= '0' && x <= '9') {
    a = (a << 3) + (a << 1) + (x - '0');
    x = getchar_unlocked();
  }
  if (neg) a = -a;
}
const int maxn = 100100, INF = (1 << 30) - 1, alpha = 28;
int n;
map<string, vector<int>> pref, suff;
string str[maxn];
bool used[alpha];
int par[alpha], rnk[alpha];
bool check[alpha];
void no() {
  printf("NO\n");
  exit(0);
}
int getpar(int a) { return a == par[a] ? a : par[a] = getpar(par[a]); }
void mrg(int a, int b) {
  int A = getpar(a), B = getpar(b);
  if (A == B) return;
  if (rnk[A] > rnk[B]) {
    par[B] = A;
  } else if (rnk[B] > rnk[A]) {
    par[A] = B;
  } else {
    par[A] = B;
    rnk[A]++;
  }
}
string addTo(int flag, string ans) {
  string tempStr;
  bool found = false;
  for (char c = 'a'; !found && c <= 'z'; c++) {
    if (used[c - 'a']) continue;
    if (flag == 0) {
      tempStr = c + ans;
      string prefIt = "";
      prefIt += tempStr[0];
      for (int i = 1; i < tempStr.size(); i++) {
        prefIt += tempStr[i];
        if (suff[prefIt].size() > 0) {
          found = true;
          used[c - 'a'] = true;
          break;
        }
      }
    } else {
      tempStr = ans + c;
      string suffIt = "";
      suffIt += tempStr[tempStr.size() - 1];
      for (int i = tempStr.size() - 2; i >= 0; i--) {
        suffIt = tempStr[i] + suffIt;
        if (pref[suffIt].size() > 0) {
          found = true;
          used[c - 'a'] = true;
          break;
        }
      }
    }
  }
  if (found) {
    return addTo(flag, tempStr);
  }
  return ans;
}
int main() {
  ri(n);
  for (int i = 0; i < n; i++) {
    cin >> str[i];
    if (str[i].size() > 26) {
      no();
    }
    int cnt[alpha];
    memset(cnt, 0, sizeof(cnt));
    string prefIt = "", suffIt = "";
    for (int j = 0; j < str[i].size(); j++) {
      prefIt += str[i][j];
      cnt[str[i][j] - 'a']++;
      if (cnt[str[i][j] - 'a'] > 1) {
        no();
      }
      pref[prefIt].push_back(i);
    }
    for (int j = str[i].size() - 1; j >= 0; j--) {
      suffIt = str[i][j] + suffIt;
      suff[suffIt].push_back(i);
    }
  }
  for (int i = 0; i < alpha; i++) {
    par[i] = i;
  }
  for (int i = 0; i < n; i++) {
    for (char c : str[i]) {
      mrg(c - 'a', str[i][0] - 'a');
    }
  }
  vector<string> ans;
  for (int i = 0; i < n; i++) {
    int num = getpar(str[i][0] - 'a');
    if (!check[num]) {
      for (char c : str[i]) {
        used[c - 'a'] = true;
      }
      ans.push_back(addTo(1, addTo(0, str[i])));
      check[num] = true;
    }
  }
  sort(ans.begin(), ans.end());
  string prnt = "";
  for (string add : ans) {
    prnt += add;
  }
  map<string, bool> occ;
  for (int i = 0; i < prnt.size(); i++) {
    string ss = "";
    ss += prnt[i];
    occ[ss] = true;
    for (int j = i + 1; j < prnt.size(); j++) {
      ss += prnt[j];
      occ[ss] = true;
    }
  }
  for (int i = 0; i < n; i++) {
    if (!occ[str[i]]) {
      no();
    }
  }
  cout << prnt << '\n';
  return 0;
}
