#include <iostream>
#include <string>

using namespace std;

string check(string a, string b)
{
    int p = -1;
    for(int i = 0;(i<a.length()&&p==-1);i++)
        if(a[i]>b[i])
            p = 0;
        else if(a[i]<b[i])
            p = 1;
    if(p==-1)
        return a;
    if(p==0)
        return a;
    if(p==1)
        return b;
}


int main()
{
    string a,b,c;
    cin>>a>>b>>c;
    string s[6];
    s[0] = a+b+c;
    s[1] = a+c+b;
    s[2] = b+a+c;
    s[3] = b+c+a;
    s[4] = c+a+b;
    s[5] = c+b+a;
    for(int i = 0;i < 5;i++)
        s[i+1] = check(s[i],s[i+1]);
    cout<<s[5]<<endl;
}