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>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

vector<bool> m1, m2;
vector<bool> reached;
vector< vector<int> > G;
bool dp(int v) {
	bool res = false;
	if (m1[v]) return m2[v];
	if (reached[v]) res = true;
	else {
		reached[v] = true;
		EACH(to, G[v]) {
			res |= dp(to);
		}
		reached[v] = false;
	}
	return m1[v] = true, m2[v] = res;
}
bool check(const vector<string>& s) {
	map<char, int> tbl;
	for (char c = 'a'; c <= 'z'; ++c) tbl[c] = (int)(c-'a');
	int N = 26;
	G = vector< vector<int> >(N);
	REP(i, s.size()) FOR(j, i+1, s.size()) {
		if (s[i] == s[j]) continue;
		if (s[i].size() > s[j].size() && s[i].substr(0, s[j].size()) == s[j]) return false;
		REP(k, min(s[i].size(), s[j].size())) {
			if (s[i][k] != s[j][k]) {
				G[tbl[s[i][k]]].pb(tbl[s[j][k]]);
				break;
			}
		}
	}
	m1 = vector<bool>(N, false);
	m2 = vector<bool>(N, false);
	reached = vector<bool>(N, false);
	REP(i, N) if ( dp(i) ) return false;
	return true;
}
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	while (cin >> N, N) {
		vector<string> s(N); cin >> s;
		vector<string> ss = s; reverse(ALL(ss));
		if ( check(s) ) cout << "yes" << endl;
		else cout << "no" << endl;
	}
}