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>
                                        #include<iostream>
                                        #include<cstdio>
                                        #include<vector>
                                        #include<queue>
                                        #include<map>
                                        #include<cstring>
                                        #include<string>
                                        #include <math.h>
                                        #include<algorithm>
                                    //    #include <boost/multiprecision/cpp_int.hpp>
                                        #include<functional>
                                #define int long long
                                        #define inf  1000000007
                                        #define pa pair<int,int>
                                        #define ll long long
                                        #define pal pair<double,pa>
                                        #define ppa pair<string,int>
                                        #define ppap pair<int,pa>
                                        #define ssa pair<string,int>
                                        #define  mp make_pair
                                        #define  pb push_back
                                        #define EPS (1e-12)
                                        #define equals(a,b) (fabs((a)-(b))<EPS)
                                  #define VI vector<int>
                                        using namespace std;
                                        
                                  class pas{
                                    	public:
                                    	int x,y;
                                    	pas(int x=0,int y=0):x(x),y(y) {}
                                    	pas operator + (pas p) {return pas(x+p.x,y+p.y);}
                                    	pas operator - (pas p) {return pas(x-p.x,y-p.y);}
                                    	pas operator * (int a) {return pas(x*a,y*a);}
                                    	pas operator / (int a) {return pas(x/a,y/a);}
                                    //	double absv() {return sqrt(norm());}
                                    	int norm() {return x*x+y*y;}
                                    	bool operator < (const pas &p) const{
                                   		return x != p.x ? x<p.x: y<p.y;
                                   	}
                                  //		bool operator < (const pas &p) const{
                                    //		return y != p.y ? y<p.y: x<p.x;
                                    //	}
                                    	bool operator == (const pas &p) const{
                                    		return x==p.x && y==p.y;
                                    	}
                                    };

                                        class Point{
                                        	public:
                                        	double x,y;
                                        	Point(double x=0,double y=0):x(x),y(y) {}
                                        	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
                                        	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
                                        	Point operator * (double a) {return Point(x*a,y*a);}
                                        	Point operator / (double a) {return Point(x/a,y/a);}
                                        	double absv() {return sqrt(norm());}
                                        	double norm() {return x*x+y*y;}
                                        	bool operator < (const Point &p) const{
                                        		return x != p.x ? x<p.x: y<p.y;
                                        	}
                                        	bool operator == (const Point &p) const{
                                        		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
                                        	}
                                        };
                                        typedef Point Vector;
                                 #define pl pair<int,pas>
                                        struct Segment{
                                        Point p1,p2;
                                        };
                                        
struct star{
Segment se[5];
};
                                         double dot(Vector a,Vector b){
                                        	return a.x*b.x+a.y*b.y;
                                        }
                                        double cross(Vector a,Vector b){
                                        	return a.x*b.y-a.y*b.x;
                                        }
                                    
            bool parareru(Point a,Point b,Point c,Point d){
            //	if(abs(cross(a-b,d-c))<EPS)cout<<"dd "<<cross(a-b,d-c)<<endl;
            	return abs(cross(a-b,d-c))<EPS;
            }
            double distance_ls_p(Point a, Point b, Point c) {
              if ( dot(b-a, c-a) < EPS ) return (c-a).absv();
              if ( dot(a-b, c-b) < EPS ) return (c-b).absv();
              return abs(cross(b-a, c-a)) / (b-a).absv();
            }
            bool is_intersected_ls(Segment a,Segment b) {
            	if(a.p1==b.p1||a.p2==b.p1||a.p1==b.p2||a.p2==b.p2) return false;
            	if(parareru((a.p2),(a.p1),(b.p1),(b.p2))&&parareru((a.p2),(a.p1),(b.p1),(b.p1))){
            //		cout<<"sss"<<endl;
            		if(dot(a.p1-b.p1,a.p1-b.p2)<EPS) return true;
            		if(dot(a.p2-b.p1,a.p2-b.p2)<EPS) return true;
            		if(dot(a.p1-b.p1,a.p2-b.p1)<EPS) return true;
            		if(dot(a.p1-b.p2,a.p2-b.p2)<EPS) return true;
            		return false;
            	}
              else return ( cross(a.p2-a.p1, b.p1-a.p1) * cross(a.p2-a.p1, b.p2-a.p1) < EPS ) && ( cross(b.p2-b.p1, a.p1-b.p1) * cross(b.p2-b.p1, a.p2-b.p1) < EPS );
            }
            double segment_len(Segment a){
            	
            	return (a.p1-a.p2).absv();
            }
            double segment_dis(Segment a,Segment b){
            	if(is_intersected_ls(a,b))return 0;
            	double r=distance_ls_p(a.p1, a.p2, b.p1);
            	r=min(r,distance_ls_p(a.p1, a.p2, b.p2));
            	r=min(r,distance_ls_p(b.p1, b.p2, a.p2));
            	r=min(r,distance_ls_p(b.p1, b.p2, a.p1));
            	return r;
            }
            Point intersection_ls(Segment a, Segment b) {
              Point ba = b.p2-b.p1;
              double d1 = abs(cross(ba, a.p1-b.p1));
              double d2 = abs(cross(ba, a.p2-b.p1));
              double t = d1 / (d1 + d2);
             
              return a.p1 + (a.p2-a.p1) * t;
            }
			pair<Point,Point> circle_intersection(Point c1,double r1,Point c2,double r2){
				double d=(c1-c2).absv();
				double h=(r1*r1-r2*r2+d*d)/2.0/d;
				double l=sqrt(r1*r1-h*h);
			//	cout<<d<<" "<<h<<" "<<l<<endl;
				Point asi=c1+(c2-c1)*h/((c2-c1).absv());
				Vector r1r2=(c2-c1)/((c2-c1).absv());
				Vector sui={r1r2.y,-r1r2.x};
			//	cout<<sui.x<<" "<<sui.y<<endl;
				pair<Point,Point> z=mp(asi+sui*l,asi-sui*l);
				if(z.first.x>z.second.x) swap(z.first,z.second);
				return z;
			}

int gcd(int x,int y){
	if(x<y) return gcd(y,x);
	if(x==y) return x;
	if(x%y==0) return y;
	return gcd(y,x%y);
}
 class pa2{
                                            public:
                                            int x,y;
                                            pa2(int x=0,int y=0):x(x),y(y) {}
                                            pa2 operator + (pa2 p) {return pa2(x+p.x,y+p.y);}
                                            pa2 operator - (pa2 p) {return pa2(x-p.x,y-p.y);}
                                            bool operator < (const pa2 &p) const{
                                                return x != p.x ? x<p.x: y<p.y;
                                            }
										 	 bool operator > (const pa2 &p) const{
                                                return x != p.x ? x>p.x: y>p.y;
                                            }
                                            bool operator == (const pa2 &p) const{
                                                return abs(x-p.x)==0 && abs(y-p.y)==0;
                                            }
                                            bool operator != (const pa2 &p) const{
                                                return !(abs(x-p.x)==0 && abs(y-p.y)==0);
                                            }
                                                 
                                         
                                        };

/*　　　---memo---
add_edge(始点,終点,youryou ,コスト)で枝追加
min_cost_flow(始点,終点,ryou)でhiyouをintで返す
*/
int n;
string s[510];
vector<int> G[30];
int shutu[30];
int rin[30][30];
queue<int> qu;
     signed main(){
     	while(1){
     	cin>>n;
     		if(n==0) return 0;
     		for(int i=0;i<n;i++)cin>>s[i];
     		if(n==1) {
     		cout<<"yes"<<endl;
     			continue;
     		}
     		
 bool bo=true;
     		
     		for(int i=0;i<30;i++){
     			G[i].clear();
     			shutu[i]=0;
     			for(int j=0;j<30;j++)rin[i][j]=0;
     		}
     		
     		for(int i=0;i<n-1;i++){
     			int l1=s[i].length(),l2=s[i+1].length();
     			if(s[i]==s[i+1]) continue;
     			if(l1<l2){
     				if(s[i+1].substr(0,l1)==s[i]) continue;
     			}
     			if(l1>l2){
     				if(s[i].substr(0,l2)==s[i+1]){
     					bo=false;
     					continue;
     				}
     			}
     			
     			for(int j=0;;j++)if(s[i][j]!=s[i+1][j]){
     				rin[s[i][j]-'a'][s[i+1][j]-'a']=1;
     				break;
     			}
     			
     		}
     		if(!bo) {
     			cout<<"no"<<endl;
     			continue;
     		}
     		
     		for(int i=0;i<26;i++)for(int j=0;j<26;j++)if(rin[i][j]){
     			G[i].pb(j);
     			shutu[j]++;
     		}
     		
     		for(int i=0;i<26;i++)if(shutu[i]==0) qu.push(i);
     		vector<int> ve;
     		while(qu.size()>0){
     			int r=qu.front();
     			qu.pop();
     			ve.pb(r);
     			for(auto v:G[r]){
     				shutu[v]--;
     				if(shutu[v]==0) qu.push(v);
     			}
     		}
     		
     		if(ve.size()==26) cout<<"yes"<<endl;
     		else cout<<"no"<<endl;
     	}
    
           	return 0;
           }
