#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 10;
string s[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  string s1, s2;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int k = n - 1; k >= 1; k--) {
    s1 = s[k - 1];
    s2 = s[k];
    int l1 = min(s1.length(), s2.length());
    int f = 1;
    for (int i = 0; i < l1; i++) {
      if (s1[i] > s2[i]) {
        s1 = s1.substr(0, i);
        break;
      }
      if (s1[i] != s2[i]) {
        f = 0;
        break;
      }
    }
    if (f && s1.length() > s2.length()) {
      s1 = s1.substr(0, l1);
    }
    s[k - 1] = s1;
  }
  for (int i = 0; i < n; i++) cout << s[i] << endl;
  return 0;
}
