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<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

vector<vector<bool>> edge(27,vector<bool>(27,false));

//強連結成分分解
class SCC{
public:
    vector<vector<ll>> E;
    vector<vector<ll>> rev;
    ll V;
    vector<ll> v;
    vector<ll> group;
    
    void dfs(ll where,ll &count){
        v[where]=-2;
        for(int i=0;i<E[where].size();i++){
            ll t=E[where][i];
            if(v[t]!=-1){continue;}
            dfs(t,count);
        }
        v[where]=count;
        count++;
    }
    
    void first(){
        ll count=0;
        for(int i=0;i<V;i++){
            if(v[i]==-1){dfs(i,count);}
        }
    }
    
    void rev_dfs(ll where,ll count){
        group[where]=count;
        for(int i=0;i<rev[where].size();i++){
            ll t=rev[where][i];
            if(group[t]!=-1){continue;}
            rev_dfs(t,count);
        }
    }
    
    void second(){
        vector<pll> number;
        for(int i=0;i<V;i++){
            number.push_back({v[i],i});
        }
        sort(number.begin(),number.end(),greater<pll>());
        ll count=0;
        for(int i=0;i<V;i++){
            ll where=number[i].S;
            if(group[where]==-1){
                rev_dfs(where,count);
                count++;
            }
        }
    }
    
    void clear(ll a){
        for(ll i=a;i<V;i++){
            v[i]=-1;
            group[i]=-1;
        }
    }
    

    SCC(ll V=0):V(V){
        v.resize(V,-1);
        E.resize(V);
        rev.resize(V);
        group.resize(V,-1);
    }
    
    void add_edge(ll from,ll to){
        E[from].push_back(to);
        rev[to].push_back(from);
    }
    
    void add_node(){
        V++;
        v.resize(V);
        E.resize(V);
        rev.resize(V);
        group.resize(V);
    }
    
    void add_node(ll number){
        V+=number;
        v.resize(V);
        E.resize(V);
        rev.resize(V);
        group.resize(V);
    }
    
    vector<ll> solve(){
        clear();
        first();
        second();
        return group;
    }
    
    //グラフの形を保ったまま初期化
    void clear(){
        for(int i=0;i<V;i++){
            v[i]=-1;
            group[i]=-1;
        }
    }
};



int main(){
    while(1){
    for(int i=0;i<27;i++){
        for(int t=0;t<27;t++){
            edge[i][t]=false;
        }
    }
    ll n;
    cin>>n;
        if(n==0){break;}
    vector<string> a(n);
    for(auto &i:a){cin>>i;}
    for(int i=0;i<26;i++){
        edge[26][i]=true;
    }
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){continue;}
        int t=0;
        while(t<a[i].size() && t<a[i-1].size() && a[i][t]==a[i-1][t]){t++;}
        if(t==a[i].size()){edge[a[i-1][t]-'a'][26]=true;}
        else if(t==a[i-1].size()){edge[26][a[i][t]-'a']=true;}
        else{edge[a[i-1][t]-'a'][a[i][t]-'a']=true;}
    }
    SCC G(27);
    for(int i=0;i<27;i++){
        for(int t=0;t<27;t++){
            if(edge[i][t]){G.add_edge(i,t);}
        }
    }
    G.solve();
    vector<ll> count(27,0);
    bool j=true;
    for(auto &i:G.group){
        count[i]++;
        if(count[i]>=2){j=false; break;}
    }
    cout<<(j?"yes":"no")<<endl;
    }
    
    
    
    return 0;
}

