#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s[n];     int a[n];     for (int x = 0; x < n; x++) {       cin >> s[x];       a[x] = s[x].length();     }     for (int x = 0; x < n; x++) {       for (int y = 0; y < n - 1; y++) {         if (a[y] > a[y + 1]) {           int t = a[y];           a[y] = a[y + 1];           a[y + 1] = t;           string temp = s[y];           s[y] = s[y + 1];           s[y + 1] = temp;         }       }     }     int f = 0;     for (int x = 0; x < n; x++) {       int i;       for (int y = x + 1; y < n; y++) {         i = s[y].find(s[x], 0);         if (i == -1) {           f = 1;           break;         }       }       if (f == 1) {         break;       }     }     if (f == 1) {       cout <<  NO ;     } else {       cout <<  YES  << endl;       for (int x = 0; x < n; x++) {         cout << s[x] << endl;       }     }   }   