#include <bits/stdc++.h>
using namespace std;
const int maxN = 500000 + 10;
int n;
string s[maxN], s1[maxN], s2[maxN];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i];
  s2[n - 1] = s[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    int j = 0;
    while (s[i][j] == s[i + 1][j]) j++;
    if (s[i][j] > s[i + 1][j]) s[i].resize(j);
    s2[i] += '#';
    for (int k = 1; k < s[i].size(); k++) {
      if (s[i][k] == 'z' || s[i][k] == 'y' || s[i][k] == 'x' ||
          s[i][k] == 'w' || s[i][k] == 'v' || s[i][k] == 'u' ||
          s[i][k] == 't' || s[i][k] == 's' || s[i][k] == 'r' ||
          s[i][k] == 'q' || s[i][k] == 'p' || s[i][k] == 'o' ||
          s[i][k] == 'n' || s[i][k] == 'm' || s[i][k] == 'l' ||
          s[i][k] == 'k' || s[i][k] == 'j' || s[i][k] == 'i' ||
          s[i][k] == 'h' || s[i][k] == 'g' || s[i][k] == 'f' ||
          s[i][k] == 'e' || s[i][k] == 'd' || s[i][k] == 'c' ||
          s[i][k] == 'b' || s[i][k] == 'a')
        s2[i] += s[i][k];
    }
  }
  for (int i = 0; i < n; i++) cout << s2[i] << endl;
  return 0;
}
