#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 9;
int n, len;
string s[N];
int getLength(int x) {
  int len = 0;
  while (len < s[x].size()) {
    if (len > s[x + 1].size()) return s[x].size();
    if (s[x][len] < s[x + 1][len]) return s[x].size();
    if (s[x][len] > s[x + 1][len]) return len;
    if (s[x][len] == s[x + 1][len]) len++;
  }
  return len;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  for (int i = n - 1; i >= 1; i--) {
    s[i] = s[i].substr(0, getLength(i));
  }
  for (int i = 1; i <= n; i++) {
    cout << s[i] << endl;
  }
  return 0;
}
