#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <string>

using namespace std;

string arr[501];
string arr2[501],arr3[501];

// a 譏ッ b 逧?燕郛?inline bool startswith(const string &a, const string &b)
{
    if (a.size()>b.size()) return false;
    if (a==b.substr(0,a.size())) return true;
    return false;
}

bool cmp(const string &a, const string &b) { if (startswith(a,b)) return true; else  return a>b;}

int main()
{
    int n;

//freopen("fuck.in","r",stdin);

    ios::sync_with_stdio(false);
    while (cin>>n && n!=0)
    {
        bool right1=true, right2=true;

        for (int i=0; i<n; i++)
        {
            cin>>arr[i];
            arr2[i]=arr3[i]=arr[i];
        }

        sort(arr2,arr2+n);
        sort(arr3,arr3+n,cmp);

        for (int i=0; i<n; i++)
        {
            if (arr[i]!=arr2[i]) {right1=false; break;}
        }
        for (int i=0; i<n; i++)
        {
            if (arr[i]!=arr3[i]) {right2=false; break;}
        }

        if (right1 || right2)
        {
            cout<<"yes\n";
        }
        else
        {
            cout<<"no\n";
        }
    }
}