#include <bits/stdc++.h>
using namespace std;
string arr[501];
string arr2[501], arr3[501];
bool cmp(const string &a, const string &b) {
  if (a.size() > b.size()) return a > b;
  if (a == b.substr(0, a.size())) return true;
  return a > b;
}
int main() {
  int n;
  ios::sync_with_stdio(false);
  while (cin >> n and 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 or right2) {
      cout << "yes\n";
    } else {
      cout << "no\n";
    }
  }
}
