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;
struct node {
  int id;
  int d;
  int next;
} side[2020000];
int head[20200];
int cnt = 0;
void init() {
  memset(head, -1, sizeof(head));
  cnt = 0;
}
void add(int x, int y, int d) {
  side[cnt].id = y;
  side[cnt].d = d;
  side[cnt].next = head[x];
  head[x] = cnt++;
}
struct nod {
  int id;
  int d;
};
int in[202];
int out[202];
int ans[200];
char ss[202000];
int ne[50];
int same[50];
set<char> tt;
int main() {
  init();
  for (int i = 0; i < 100; i++) {
    in[i] = 999999;
    out[i] = 999999;
  }
  int n;
  scanf("%d", &n);
  int flag = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s", ss);
    int j = 0;
    memset(same, 0, sizeof(same));
    while (ss[j] != '\0') {
      same[ss[j] - 'a' + 1]++;
      if (same[ss[j] - 'a' + 1] > 1) flag = 1;
      out[ss[j] - 'a' + 1] = 0;
      in[ss[j] - 'a' + 1] = 0;
      tt.insert(ss[j]);
      if (j > 0) {
        if (ne[ss[j - 1] - 'a' + 1] == 0)
          ne[ss[j - 1] - 'a' + 1] = ss[j] - 'a' + 1;
        else if (ne[ss[j - 1] - 'a' + 1] != ss[j] - 'a' + 1)
          flag = 1;
      }
      j++;
    }
  }
  if (flag) {
    printf("NO\n");
  } else {
    for (int i = 1; i <= 26; i++) {
      if (ne[i] != 0) {
        add(i, ne[i], 0);
        out[i]++;
        in[ne[i]]++;
      }
    }
    int flag1 = 0;
    for (int i = 1; i <= 26; i++) {
      int ii = in[i];
      int oo = out[i];
      if (ii != 0 && ii != 1 && ii != 999999) {
        flag1 = 1;
      } else if (oo != 0 && oo != 1 && oo != 999999) {
        flag1 = 1;
      }
    }
    if (flag1)
      printf("NO\n");
    else {
      priority_queue<int, vector<int>, greater<int> > que;
      for (int i = 1; i <= 26; i++) {
        if (in[i] == 0) que.push(i);
      }
      int cntt = 0;
      while (!que.empty()) {
        int t = que.top();
        que.pop();
        ans[cntt++] = t;
        while (1) {
          int i = head[t];
          if (i != -1) {
            int y = side[i].id;
            in[y]--;
            ans[cntt++] = y;
            t = y;
          } else {
            break;
          }
        }
      }
      if (flag == 1 || cntt < tt.size())
        printf("NO\n");
      else {
        for (int i = 0; i < cntt; i++) {
          printf("%c", ans[i] + 'a' - 1);
        }
        printf("\n");
      }
    }
  }
  return 0;
}
