#include <bits/stdc++.h>
using namespace std;
string a[500], b[500], c[500];
int main() {
  int n, k;
  while (cin >> n) {
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      b[i] = a[i];
    }
    sort(b, b + n);
    for (k = 0; k < n; k++) {
      cout << b[k] << endl;
      if (a[k] != b[k]) break;
    }
    if (k >= n) {
      cout << "yes" << endl;
      continue;
    }
    for (k = 0; k < n; k++) {
      if (a[k] != b[n - k - 1]) break;
    }
    if (k >= n) {
      cout << "yes" << endl;
      continue;
    }
    cout << "no" << endl;
  }
  return 0;
}
