#include <bits/stdc++.h>
using namespace std;
char temp[500005];
int main() {
  int n;
  scanf("%d", &n);
  vector<string> v;
  for (int i = 0; i < n; i++) {
    scanf("%s", temp);
    v.push_back(temp);
  }
  for (int i = (int)v.size() - 2; i >= 0; i--) {
    string s = "#";
    for (int j = 1; j < v[i].size(); j++) {
      if (v[i][j] > v[i + 1][j]) {
        v[i] = s;
        break;
      }
      if (v[i][j] < v[i + 1][j]) break;
      s += v[i][j];
    }
  }
  for (int i = 0; i < v.size(); i++) printf("%s\n", v[i].c_str());
  return 0;
}
