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

int main()
{
    string a,b,c,d;
    int i,j1=1,j2=1,j3=1;
    cin>>a;
    cin>>b;
    cin>>c;
    for(i=0;i<min(a.length(),b.length());i++)
    {
        if(a[i]>b[i])
        {
            j1=1;
            break;
        }
        if(a[i]<b[i])
        {
            j1=2;
            break;
        }
    }
    for(i=0;i<min(a.length(),c.length());i++)
    {
        if(a[i]>c[i])
        {
            j2=1;
            break;
        }
         if(a[i]<c[i])
        {
            j2=2;
            break;
        }
    }
    for(i=0;i<min(b.length(),c.length());i++)
    {
        if(b[i]>c[i])
        {
            j3=1;
            break;
        }
         if(b[i]<c[i])
        {
            j3=2;
            break;
        }
    }
    if(j1==1 && j2==1)
    {
        if(j3==1)
        {
            d=a+b+c;
        }
        else
            d=a+c+b;
    }
    else
    {
        if(j1==1 && j2==2)
            d=c+a+b;
            else
            if(j1==2 && j1==1)
            d=b+a+c;
            else
        {
            if(j3=1)
                d=b+c+a;
            else
                d=c+b+a;
        }
    }
    cout<<d;
    return 0;
}