#include<bits/stdc++.h>
using namespace std;

int n, l1, l2, j;
string s;
vector<string> input;
int main(){
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> s;
        input.push_back(s);
    }
    for(int i = n - 2; i >= 0; --i){
        l1 = input[i + 1].size();
        l2 = input[i].size();
        s = "#";
        for(int j = 1; j < l1 && j < l2; ++j){
            if(input[i][j] == input[i+1][j]) s += input[i][j];
            else if(input[i][j] < input[i+1][j]){
                s = input[i];
                break;
            }
            else break;
        }
        input[i] = s;
    }
    for(int i = 0; i < n; ++i) cout << input[i] << endl;
}
