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 <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &x) {
  return os << "(" << x.first << "," << x.second << ")";
}
namespace dbg_ns {
template <typename C>
struct is_iterable {
  template <class T>
  static long check(...);
  template <class T>
  static char check(int, typename T::const_iterator = C().end());
  enum {
    value = sizeof(check<C>(0)) == sizeof(char),
    neg_value = sizeof(check<C>(0)) != sizeof(char)
  };
};
template <class T>
ostream &_out_str(ostream &os, const T &x) {
  return os << '"' << x << '"';
}
template <class T>
ostream &_dbg2_5(ostream &, const T &);
template <bool B, typename T = void>
using eit = typename enable_if<B, T>::type;
template <class T>
inline ostream &_dbg3(ostream &os, eit<is_iterable<T>::neg_value, const T> &x) {
  return os << x;
}
template <class T>
inline ostream &_dbg3(ostream &os, eit<is_iterable<T>::value, const T> &V) {
  os << "{";
  bool ff = 0;
  for (const auto &E : V) _dbg2_5(ff ? os << "," : os, E), ff = 1;
  return os << "}";
}
template <>
inline ostream &_dbg3<string>(ostream &os, const string &x) {
  return _out_str(os, x);
}
template <>
inline ostream &_dbg3<const char *>(ostream &os, const char *const &x) {
  return _out_str(os, x);
}
template <class T>
inline ostream &_dbg2_5(ostream &os, const T &x) {
  return _dbg3<T>(os, x);
}
template <class T, typename... Args>
ostream &_dbg2(ostream &os, vector<string>::iterator nm, const T &x,
               Args &&...args);
inline ostream &_dbg2(ostream &os, vector<string>::iterator) { return os; }
template <typename... Args>
inline ostream &_dbg2(ostream &os, vector<string>::iterator nm, const char *x,
                      Args &&...args) {
  return _dbg2(_dbg3<const char *>(os << "  ", x), nm + 1, args...);
}
template <class T, typename... Args>
inline ostream &_dbg2(ostream &os, vector<string>::iterator nm, const T &x,
                      Args &&...args) {
  return _dbg2(_dbg3<T>(os << "  " << *nm << "=", x), nm + 1, args...);
}
vector<string> split(string s) {
  vector<string> Z;
  string z = "";
  s += ',';
  int dep = 0;
  for (char c : s) {
    if (c == ',' && !dep)
      Z.push_back(z), z = "";
    else
      z += c;
    if (c == '(') ++dep;
    if (c == ')') --dep;
  }
  return Z;
}
template <typename... Args>
inline ostream &_dbg1(int ln, const string &nm, Args &&...args) {
  auto nms = split(nm);
  return _dbg2(cerr << "L" << ln << ":", nms.begin(), args...) << endl;
}
}  // namespace dbg_ns
typedef long double ld;
const ld eps = (ld)1e-8;
const ld tau = 2 * (ld)acosl(-1);
const int inf = 1e9 + 99;
const long long linf = 1e18 + 99;
const int P = 1e9 + 7;
void fail() {
  cout << "NO" << endl;
  exit(0);
}
const int N = 100 << 10;
string s[N];
bool ex[26];
int nxt[26];
bool sn[26];
int id[26];
string Z = "";
void dfs(int c) {
  if (sn[c]) fail();
  sn[c] = 1;
  Z += char(c + 'a');
  if (~nxt[c]) dfs(nxt[c]);
}
int32_t main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int c = 0; c < 26; c++) nxt[c] = -1;
  for (int i = 0; i < n; i++)
    for (char c : s[i]) ex[c - 'a'] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 1; j < (int(s[i].size())); j++) {
      char c = s[i][j - 1];
      char d = s[i][j];
      if (nxt[c - 'a'] != -1 && nxt[c - 'a'] != d - 'a') fail();
      nxt[c - 'a'] = d - 'a';
    }
  for (int c = 0; c < 26; c++)
    if (~nxt[c]) ++id[nxt[c]];
  for (int c = 0; c < 26; c++)
    if (id[c] > 1) fail();
  for (int c = 0; c < 26; c++) {
    if (!ex[c]) continue;
    if (id[c]) continue;
    if (sn[c]) continue;
    dfs(c);
  }
  for (int c = 0; c < 26; c++)
    if (ex[c] && !sn[c]) fail();
  cout << Z << endl;
}
