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 double PI = acos(0) * 2;
const double EPS = 1e-8;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcounll(s);
}
template <class T>
T sqr(T x) {
  return x * x;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
int n;
string s[MAXN];
int has[30], vs[30], pa[30];
void dfs(int u) {
  cout << (char)(u + 'a');
  if (!~has[u]) return;
  dfs(has[u]);
}
int cango(int u, int v) {
  while (~u) {
    if (u == v) return 1;
    u = has[u];
  }
  return 0;
}
int main() {
  cin >> n;
  for (int i = (0); i < (n); i++) cin >> s[i];
  for (int i = (0); i < (26); i++) has[i] = -1, pa[i] = -1;
  for (int i = (0); i < (n); i++) {
    int cur = s[i][0] - 'a';
    vs[cur] = 1;
    for (int j = (1); j < (((int)(s[i]).size())); j++) {
      int cur = s[i][j] - 'a';
      int pre = s[i][j - 1] - 'a';
      vs[cur] = 1;
      vs[pre] = 1;
      if (has[pre] != -1 && has[pre] != cur) {
        cout << "NO";
        return 0;
      }
      has[pre] = cur;
      if (pa[cur] != -1 && pa[cur] != pre) {
        cout << "NO";
        return 0;
      }
      pa[cur] = pre;
      if (cango(cur, pre)) {
        cout << "NO";
        return 0;
      }
    }
  }
  for (int i = (0); i < (26); i++) {
    if (!~pa[i] && vs[i]) {
      dfs(i);
    }
  }
  return 0;
}
