#include <bits/stdc++.h>   using namespace std;   int graph[27];   int grapht[27];   vector<bool> used(27, false);   vector<bool> opened(27, false);   string result;   void dfs(int node) {     used[node] = true;     opened[node] = true;     if (graph[node] == -1) {       result += (node +  a );       opened[node] = false;       return;     }     if (opened[graph[node]]) {       cout <<  NO ;       exit(0);     }     dfs(graph[node]);     opened[node] = false;     result += (node +  a );   }   void dfsn(int node) {     opened[node] = true;     if (graph[node] != -1) {       if (opened[graph[node]]) {         cout <<  NO ;         exit(0);       }       dfsn(graph[node]);     }     opened[node] = false;   }   set<int> letter;   int main() {     int n;     cin >> n;     fill(graph, graph + 27, -1);     fill(grapht, grapht + 27, -1);     while (n--) {       string s;       cin >> s;       for (int i = 0; i < s.size() - 1; i++) {         int b = s[i] -  a ;         int e = s[i + 1] -  a ;         if ((graph[b] != -1 && graph[b] != e) ||             (grapht[e] != -1 && grapht[e] != b)) {           cout <<  NO ;           exit(0);         }         graph[b] = e;         grapht[e] = b;       }       for (auto i = s.begin(); i != s.end(); i++) {         letter.insert(*i -  a );       }     }     for (int i = 0; i < 27; i++) {       dfsn(i);     }     for (int i = 26; i >= 0; i--) {       if (letter.find(i) != letter.end() && grapht[i] == -1) {         dfs(i);       }     }     reverse(result.begin(), result.end());     cout << result;     return 0;   }   