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>
char str[100005][30];
int ns[100005];
int intr[30];
int rem;
int n;
int find_first() {
  int i;
  int bst = -1;
  for (i = 0; i < n; i++) {
    if (ns[i] > 0 && intr[str[i][0] - 'a'] == 0 &&
        (bst == -1 || str[i][0] < str[bst][0]))
      bst = i;
  }
  return bst;
}
int main() {
  int i, j, k;
  char inp[100005];
  int seen[30];
  char out[30];
  char used[30];
  int o, m;
  for (i = 0; i < 100005; i++) ns[i] = 0;
  for (i = 0; i < 30; i++) intr[i] = used[i] = 0;
  scanf("%d", &n);
  rem = n;
  for (i = 0; i < n; i++) {
    scanf("%s", inp);
    for (j = 0; j < 30; j++) seen[j] = 0;
    for (j = 0; inp[j] != '\0'; j++) {
      if (seen[inp[j] - 'a']) {
        printf("NO\n");
        return 0;
      }
      if (j > 0) intr[inp[j] - 'a'] = 1;
      seen[inp[j] - 'a'] = 1;
      str[i][j] = inp[j];
      ns[i]++;
    }
    str[i][ns[i]] = '\0';
  }
  for (o = 0, m = 0; rem > 0; o++) {
    if (m == o) {
      int c = find_first();
      if (c == -1) {
        printf("NO\n");
        return 0;
      }
      if (used[str[c][0] - 'a']) {
        printf("NO\n");
        return 0;
      }
      used[str[c][0] - 'a'] = 1;
      out[m] = str[c][0];
      m++;
    }
    for (i = 0; i < n; i++) {
      if (str[i][0] != out[o] || ns[i] == 0) continue;
      for (j = 0; j < ns[i]; j++) {
        if (j < m - o) {
          if (str[i][j] != out[o + j]) {
            printf("NO\n");
            return 0;
          }
        } else {
          if (used[str[i][j] - 'a']) {
            printf("NO\n");
            return 0;
          }
          used[str[i][j] - 'a'] = 1;
          out[m] = str[i][j];
          m++;
        }
      }
      ns[i] = 0;
      rem--;
    }
  }
  out[m] = '\0';
  printf("%s\n", out);
  return 0;
}
