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 <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define PER(i, x, y) for(ll i = x; i > y; i--)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

struct edge {
    ll to, cost;
};

int V;
vector<edge> G[30];

void addedge(int st, int ed, ll co) {
    edge e;
    e.to = ed;
    e.cost = co;
    G[st].push_back(e);
}

int h[30];
vector<int> tsorted;

//トポロジカルソート。結果はtsortedに入る。
bool tsort() {
    fill(h, h + V, 0);
    tsorted.clear();
    for (int i = 0; i < V; i++) {
        int len = G[i].size();
        for (int j = 0; j < len; j++) {
            h[G[i][j].to]++;
        }
    }
    queue<int> que;
    for (int i = 0; i < V; i++) {
        if (h[i] == 0) {
            que.push(i);
            tsorted.push_back(i);
        }
    }
    while (!que.empty()) {
        int p = que.front();
        que.pop();
        int len = G[p].size();
        for (int i = 0; i < len; i++) {
            int mark = G[p][i].to;
            h[mark]--;
            if (h[mark] == 0) {
                que.push(mark);
                tsorted.push_back(mark);
            }
        }
    }
    int sortedsize = tsorted.size();
    if (sortedsize == V) {
        return true;
    } else {
        return false;
    }
}

bool ed[30][30];

int main() {
    while (1) {
        ll n;
        cin >> n;
        V = 26;
        REP(i, 0, V) {
            G[i].clear();
        }
        if (n == 0) {
            break;
        }
        string s[n];
        REP(i, 0, n) {
            cin >> s[i];
        }
        REP(i, 0, V) {
            fill(ed[i], ed[i] + V, false);
        }
        bool ok = true;
        REP(i, 0, n - 1) {
            string s1 = s[i];
            string s2 = s[i + 1];
            ll len1 = s1.size();
            ll len2 = s2.size();
            bool tmp = false;
            REP(i, 0, min(len1, len2)) {
                if (s1[i] != s2[i]) {
                    ed[s1[i] - 'a'][s2[i] - 'a'] = true;
                    tmp = true;
                    break;
                }
            }
            if (!tmp) {
                if (len1 > len2) {
                    ok = false;
                    break;
                }
            }
        }
        REP(i, 0, V) {
            REP(j, 0, V) {
                if (ed[i][j]) {
                    addedge(i, j, 1);
                }
            }
        }
        bool tmp2 = tsort();
        if (!tmp2) {
            ok = false;
        }
        if (ok) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
}

