#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const double eps = 1e-10;
const int inf = 0x3f3f3f3f;
const int N = 5 * 1e5 + 10;
string s[N], ans[N];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int len = 0;
    for (int i = 1; i <= n; i++) {
      s[i].clear();
      ans[i].clear();
      cin >> s[i];
    }
    ans[n] = s[n];
    for (int i = n - 1; i >= 1; i--) {
      int ok = 0, l = s[i].size();
      ans[i] += '#';
      for (int j = 1; j < l; j++)
        if (ok)
          ans[i] += s[i][j];
        else if (s[i][j] <= ans[i + 1][j]) {
          ans[i] += s[i][j];
          if (s[i][j] < ans[i + 1][j]) ok = 1;
        } else
          break;
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << "\n";
  }
  return 0;
}
