#include <bits/stdc++.h>
using namespace std;
int n;
string a[500010];
int en[500010];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    en[i] = a[i].length();
  }
  for (int i = n - 2; i >= 0; i--) {
    int j = 1;
    bool gre = 0;
    while (j < en[i + 1] && j < en[i] && a[i + 1][j] >= a[i][j]) {
      if (a[i + 1][j] > a[i][j]) gre = 1;
      j++;
    }
    if (gre) continue;
    en[i] = j;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < en[i]; j++) cout << a[i][j];
    cout << '\n';
  }
}
