#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
string s[N];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = n - 2; i >= 0; i--) {
    int len1 = s[i + 1].length();
    int len2 = s[i].length();
    int len = max(len1, len2);
    string str = "#";
    for (int j = 1; j < len; j++) {
      if (j < len2)
        str.push_back(s[i][j]);
      else
        break;
      if (str > s[i + 1]) {
        str.pop_back();
        break;
      }
    }
    s[i] = str;
  }
  for (int i = 0; i < n; i++) {
    cout << s[i] << endl;
  }
  return 0;
}
