Problem Statement

We found a dictionary of the Ancient Civilization Mayo (ACM) during excavation of the ruins. After analysis of the dictionary, we revealed they used a language that had not more than 26 letters. So one of us mapped each letter to a different English alphabet and typed all the words in the dictionary into a computer.

How the words are ordered in the dictionary, especially whether they are ordered lexicographically, is an interesting topic to many people. As a good programmer, you are requested to write a program to judge whether we can consider the words to be sorted in a lexicographical order.

Note: In a lexicographical order, a word always precedes other words it is a prefix of. For example, `ab` precedes `abc`, `abde`, and so on.



Input

The input consists of multiple datasets. Each dataset is formatted as follows:


n
string_1
...
string_n


Each dataset consists of n+1 lines. The first line of each dataset contains an integer that indicates n (1 \leq n \leq 500). The i-th line of the following n lines contains string_i, which consists of up to 10 English lowercase letters.

The end of the input is `0`, and this should not be processed.

Output

Print either `yes` or `no` in a line for each dataset, in the order of the input. If all words in the dataset can be considered to be ordered lexicographically, print `yes`. Otherwise, print `no`.

Example

Input

4
cba
cab
b
a
3
bca
ab
a
5
abc
acb
b
c
c
5
abc
acb
c
b
b
0


Output

yes
no
yes
no
#include <bits/stdc++.h>
template<typename T>
struct Edge {
    int from, to;
    T cost;
    Edge(int from, int to, T cost) {
        this->from = from;
        this->to = to;
        this->cost = cost;
    }
};
bool operator == (Edge<int> e1, Edge<int> e2) {
    return e1.from == e2.from &&
            e1.to == e2.to &&
            e1.cost == e2.cost;
}
template<typename T>
using Edges = std::vector<Edge<T>>;
template<typename T>
using Graph = std::vector<Edges<T>>;
template<typename T>
std::vector<int> topological_sort(const Graph<T> &graph) {
    Graph<T> g = graph;
    int n = g.size();
    std::vector<int> res;
    std::queue<int> que;
    std::vector<int> in(n);
    std::vector<bool> used(n, false);
    for(int i=0;i<n;++i) {
        for(int j=0;j<(int)(g[i].size());++j) {
            in[g[i][j].to]++;
        }
    }
    for(int i=0;i<n;++i) {
        if(in[i] == 0) que.push(i);
    }
    if((int)(que.size()) == 0) res.push_back(-1);
    while(!que.empty()) {
        int now = que.front(); que.pop();
        if(used[now]) {
            res.clear();
            res.push_back(-1);
            return res;
        }
        used[now] = true;
        res.push_back(now);
        for(int i=0;i<(int)(g[now].size());++i) {
            int next = g[now][i].to;
            if(in[next] == 1) {
                que.push(next);
        }
            in[next]--;
        }
    }
    return res;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    Graph<int> g(26);
    map<P, bool> sel;
    vector<string> vs(n);
    for(int i=0;i<n;++i) {
      cin >> vs[i];
    }
    if(n == 1) {
      cout << "yes" << endl;
      continue;
    }
    string s1 = vs[0];
    bool ok = true;
    for(int i=1;i<n;++i) {
      string s2 = vs[i];
      bool upd = false;
      for(int j=0;j<min((int)(s1.size()), (int)(s2.size()));++j) {
        if(s1[j] != s2[j]) {
          int a = (int)(s1[j] - 'a'), b = (int)(s2[j] - 'a');
          upd = true;
          if(!sel[{a, b}]) {
            sel[{a, b}] = true;
            g[a].push_back(Edge<int>(a, b, 1));
          }
          break;
        }
      }
      if(!upd && (int)(s1.size()) > (int)(s2.size())) {
        ok = false;
        break;
      }
      s1 = s2;
    }
    if(!ok) {
      cout << "no" << endl;
      continue;
    }
    vector<int> tmp = topological_sort(g);
    if((int)(tmp.size()) < 26) {
      cout << "no" << endl;
    } else {
      cout << "yes" << endl;
    }
  }
}

