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;
using namespace std::chrono;
const long long big = 1000000007ll;
const long long big2 = 1000000009ll;
long long n, m, k, q, h, T;
long long par[26] = {0};
long long nex[26] = {0};
bool seen[26] = {0};
int main() {
  long long a, b, c, d;
  for (long long c1 = 0; c1 < 26; c1++) par[c1] = -1;
  for (long long c1 = 0; c1 < 26; c1++) nex[c1] = -1;
  cin >> n;
  bool fail = 0;
  for (long long c1 = 0; c1 < n; c1++) {
    string s;
    cin >> s;
    if (s.length() == 1) {
      seen[s[0] - 'a'] = 1;
    }
    for (long long c2 = 1; c2 < s.length(); c2++) {
      a = s[c2 - 1] - 'a';
      b = s[c2] - 'a';
      seen[a] = 1;
      seen[b] = 1;
      if (par[b] != -1 && par[b] != a) {
        fail = 1;
      } else {
        par[b] = a;
      }
      if (nex[a] != -1 && nex[a] != b) {
        fail = 1;
      } else {
        nex[a] = b;
      }
    }
  }
  long long nseen = 0;
  for (long long c1 = 0; c1 < 26; c1++) nseen += seen[c1];
  string ans = "";
  string alfa = "abcdefghijklmnopqrstuvwxyz";
  bool mark[26] = {0};
  for (long long c1 = 0; c1 < 26; c1++) {
    if (seen[c1] && !mark[c1]) {
      if (par[c1] == -1) {
        mark[c1] = 1;
        ans += alfa[c1];
        a = c1;
        while (nex[a] != -1) {
          a = nex[a];
          ans += alfa[a];
          if (mark[a]) {
            fail = 1;
            break;
          }
          mark[a] = 1;
        }
      }
    }
  }
  if (ans.length() != nseen) fail = 1;
  if (fail) {
    cout << "NO\n";
  } else {
    cout << ans << "\n";
  }
  return 0;
}
