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 <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <fstream>
#include <cassert>
using namespace std;

//common

typedef int  i32;
typedef long long i64,ll;
typedef long double ld;

#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,r) for(int i=(int)l;i<(int)(r);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//config
//#define NDEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}

template<class T> inline string toString(const vector<vector<T> >& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

string BITtoString(int bit){
    stringstream ss;
    while(bit!=0){ss<<(bit%2);bit/=2;}
    string res=ss.str();reverse(ALL(res));
    return res;
}

template<typename T,typename V> inline T pmod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}
#define nextInt(n) scanf("%d",&n)
#define defInt(n) int n;nextInt(n)
#define nextLong(n) scanf("%lld",&n)
#define defLong(n) ll n;nextLong(n)
#define nextDouble(n) scanf("%lf",&n)

namespace Sccs{
    struct Edge{
        int to;
        Edge(int to):to(to){};
    };
    typedef vector<vector<Edge> > Graph;

    //O(V+E)
    class Scc{
    private:
        int V;
        Graph g,rg;
        vector<bool> used;
       
        void dfs(int v){
            used[v]=true;
            EACH(e,g[v])if(!used[e->to])dfs(e->to);
            vs.push_back(v);
        }
        void rdfs(int v,int k){
            used[v]=true;
            cmp[v]=k;
            EACH(e,rg[v])if(!used[e->to])rdfs(e->to,k);
        }
    public:
         vector<int> vs,cmp; //cmp...強連結成分を同一視したトポロジカルソート順序

        Scc(int V):V(V){
            g=Graph(V);rg=Graph(V);
            vs=vector<int>(V);cmp=vector<int>(V);used=vector<bool>(V);
        }
        void add_edge(int f,int t){
            g[f].push_back(t);rg[t].push_back(f);
        }
        int scc(){
            fill(ALL(used),false);
            vs.clear();
            REP(v,V)if(!used[v])dfs(v);

            fill(ALL(used),false);
            int k=0;
            for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]])rdfs(vs[i],k++);
            return k;
        }
        //sample
        bool same(int i,int j){
            return cmp[i]==cmp[j];
        }
    };
}
using namespace Sccs;
class Main{
public:
	void run(){
	//	ifstream cin("in");
	//	ofstream cout( "out" );
		while(true){
			int N;cin >> N;
			if(N==0)break;
			vector<string> ss(N);
			REP(i,N) cin >> ss[i];

			bool ok=true;
			Scc scc(26);
			for(int i=0;i+1<N;i++){
				for(int c=0;true;c++){
					if((c<ss[i].size()) && !(c<ss[i+1].size())){
						ok=false;
					}
					if(!(c<min(ss[i].size(),ss[i+1].size())))break;

					if(ss[i][c]!=ss[i+1][c]){
						scc.add_edge(ss[i][c]-'a',ss[i+1][c]-'a');
					//	DUMP(ss[i][c]);DUMP(ss[i+1][c]);
						break;
					}
				}
			}
			scc.scc();
			REP(i,26)REP(j,26) if(i!=j){
				if(scc.same(i, j))ok=false;
			}
			cout << (ok?"yes":"no")<<endl;
		}
	}
};
int main(){
	cout <<fixed<<setprecision(13);	
	ios::sync_with_stdio(false);
	Main().run();
	return 0;
}