#include <bits/stdc++.h>
using namespace std;
long long n, i, j, f1;
pair<long long, char> h[256];
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (i = 0; i <= 255; i++) h[i].second = '!';
  for (i = 1; i <= n; i++) {
    cin >> s;
    if (h[s[0]].first == 0) h[s[0]].first = 1;
    for (j = 1; j < s.size(); j++) {
      if (h[s[j - 1]].first == 0 ||
          (h[s[j - 1]].first != 0 && h[s[j - 1]].second != s[j])) {
        cout << "NO"
             << "\n";
        return 0;
      }
      h[s[j - 1]].second = s[j];
      h[s[j]].first = 1;
    }
  }
  for (char x = 'a'; x <= 'z'; x++)
    cout << h[x].first << " " << h[x].second << "\n";
  return 0;
}
