#include <bits/stdc++.h>
using namespace std;
bool cmp(string &a, string &b, int n) {
  for (int i = 0; i < n; i++) {
    if (i >= b.size() || a[i] > b[i]) return 0;
    if (a[i] < b[i]) return 1;
  }
  return 1;
}
int main() {
  int n;
  scanf("%d ", &n);
  static string s[500010];
  char buf[500010];
  for (int i = 0; i < n; i++) {
    scanf(" %s", buf);
    s[i] = buf + 1;
  }
  for (int i = n - 2; i >= 0; i--) {
    int l = 0, r = s[i].size();
    while (l + 1 < r) {
      int m = l + (r - l) / 2;
      if (cmp(s[i], s[i + 1], m))
        l = m;
      else
        r = m;
    }
    int k = (cmp(s[i], s[i + 1], r) ? r : l);
    s[i].resize(k);
  }
  for (int i = 0; i < n; i++) {
    printf("#%s\n", s[i].c_str());
  }
}
