// editor2
#include<iostream>
#include<sstream>
#include<vector>
#include<cctype>
using namespace std;
int main(){
    string line;
    getline(cin,line);
    string steam ss(line);
    string word;
    vector<string>order(101);
    int maxpos=0;
    while(ss>>word){
        int pos=-1;
        for (char c:word)
        if(c=='-'){
            cout<,"Invaild input";
            return 0;
        }
        if (isdigit(c)){
            pos=c-'0';
        }
    }
    if(pos==-1)continue;
    string clean="";
    for(char c:word)
    if(!isdigit(c))
    clean+=c;
    
    ordered[pos]=clean;
    if(pos>maxpos)
    maxpos=pos;
}
for(int i=0;i<=maxpos;i++){
    if(!ordered[i].empty())
{
    cout<<ordered[i];
    if(i<maxpos)
    count<<"";
}
return 0;
}