#include<iostream>
#include<string.h>
#include<vector>
using namespace std;

int main(){
    char* str = new char[20];
    while(cin>>str){
        vector<char*>strs;
        while(true){
            for(vector<char*>::iterator i = strs.begin();;i++)
            {
                if(i==strs.end()){
                    strs.push_back(str);
                    break;
                }
                if(strcmp(*i,str)>0){
                    strs.insert(i,str);
                    break;
                }
            }
            if(cin.get() == '\n'){
                for(vector<char*>::iterator i = strs.begin();i != strs.end();i++)
                    cout<<*i<<" ";
                break;
            }
            str = new char[20];
            cin>>str;
        }
        cout<<endl;
    }
}