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 N = 1e5 + 5;
const int M = 26;
char s[N];
int vis[M], adj[M][M];
int numIn[M], dfsOrd[M];
int visOrd = 1;
bool isOccur[M];
bool dfs(int node) {
  vis[node] = 1;
  int cc = 0;
  ++numIn[node];
  for (int i = 0; i < M; ++i) {
    if (adj[node][i]) {
      ++cc;
      if (vis[i] == 1) {
        return false;
      } else if (vis[i] == 0) {
        if (dfs(i) == false) {
          return false;
        }
      }
    }
  }
  if (cc >= 2) {
    return false;
  }
  vis[node] = 2;
  dfsOrd[node] = visOrd++;
  return true;
}
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    memset(vis, 0, sizeof(vis));
    for (int j = 0;; ++j) {
      if (s[j] == 0) {
        break;
      }
      int u = s[j] - 'a';
      isOccur[u] = true;
      if (vis[u]) {
        printf("NO\n");
        return;
      }
      vis[u] = true;
      if (j - 1 >= 0) {
        int v = s[j - 1] - 'a';
        adj[u][v] = true;
      }
    }
  }
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < M; ++i) {
    if (isOccur[i] && vis[i] == 0) {
      if (dfs(i) == false) {
        printf("NO\n");
        return;
      }
    }
  }
  vector<pair<int, int> > v;
  for (int i = 0; i < M; ++i) {
    int ee = 0;
    for (int j = 0; j < M; ++j) {
      if (adj[j][i]) {
        ++ee;
      }
    }
    if (ee >= 2) {
      printf("NO\n");
      return;
    }
  }
  for (int i = 0; i < M; ++i) {
    if (numIn[i] >= 2) {
      printf("NO\n");
      return;
    }
    if (isOccur[i]) {
      v.push_back(make_pair(dfsOrd[i], i));
    }
  }
  sort(v.begin(), v.end());
  memset(vis, 0, sizeof(vis));
  vector<string> R;
  for (int i = v.size() - 1; i >= 0; --i) {
    int node = v[i].second;
    if (vis[node] == false) {
      string tmp;
      while (true) {
        tmp += char('a' + node);
        vis[node] = true;
        bool canGo = false;
        for (int i = 0; i < M; ++i) {
          if (adj[node][i]) {
            node = i;
            canGo = true;
            break;
          }
        }
        if (canGo == false) {
          break;
        }
      }
      reverse(tmp.begin(), tmp.end());
      R.push_back(tmp);
    }
  }
  sort(R.begin(), R.end());
  string ret;
  for (int i = 0; i < (int)R.size(); ++i) {
    ret += R[i];
  }
  cout << ret << endl;
}
int main() { solve(); }
