#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int nadjiveci(string a1,string a2,int i1,int i2)
{
    int i=0,k=0;
    if(a1==a2)
    {
        return 1;
    }
    for(i=0;i<min(a1.length()-i1,a2.length()-i2);i++)
    {
        if(a1[i+i1]>a2[i+i2])
        {
            k=1;
            break;
        }
        if(a2[i+i1]>a1[i+i2])
        {
            k=2;
            break;
        }
    }
    if(k!=0)
    {
        return k;
    }
    else
        if(a1.length() > a2.length())
    {
        k=nadjiveci(a1,a2,i1+a2.length(),i2);

    }
    else
        k=nadjiveci(a1,a2,i1,i2+a1.length());
        return k;

}
int main()
{
    string a,b,c,d,a1,a2;
    int i,j1,j2,j3;
    cin>>a;
    cin>>b;
    cin>>c;
    j1=nadjiveci(a,b,0,0);
    j2=nadjiveci(a,c,0,0);
    j3=nadjiveci(b,c,0,0);
    if(j1==1 && j2== 1 & j3==1)
        d=a+b+c;
    if(j1==1 && j2== 1 & j3==2)
        d=a+c+b;
    if(j1==1 && j2== 2 & j3==2)
        d=c+a+b;
    if(j1==2 && j2== 2 & j3==2)
        d=c+b+a;
    if(j1==2 && j2== 1 & j3==1)
        d=b+a+c;
    if(j1==2 && j2==2 && j3==1)
        d=b+c+a;
    cout << d;
    return 0;
}