#include <bits/stdc++.h>

using namespace std;

int main()
{
    int x,ja=0,jb=0,jc=0;
    int xa=2,xb=3,xc=4;
    string a,b,c;
    int bul=1;
    string sum;
    cin >> a >> b >> c;
    if (a==b && a==c){
        sum=a + b + c;
        cout << sum << endl;
        return 0;
    }
    for (int i=0;bul!=0;i++){
        if (a[ja+1]=='\0'){ja=a.length()-1;xa=1;} else {ja=i;}
        if (b[jb+1]=='\0'){jb=b.length()-1;xb=1;} else {jb=i;}
        if (c[jc+1]=='\0'){jc=c.length()-1;xc=1;} else {jc=i;}

        if (a[ja]>b[jb] && a[ja]>c[jc]){
            x=1;
            bul=0;
        }
        else if (b[jb]>a[ja] && b[jb]>c[jc]){
            x=2;
            bul=0;
        }
        else if (c[jc]>a[ja] && c[jc]>b[jb]){
            x=3;
            bul=0;
        }
        else if (xa==xb && xb==xc){
            sum = a + b + c;
            cout << sum;
            return 0;
        }
    }
    bul=1;
    ja=0;jb=0;jc=0;
    xa=2;xb=3;xc=4;
    for (int i=0;bul!=0;i++){
        if (a[ja+1]=='\0'){ja=a.length()-1;xa=1;} else {ja=i;}
        if (b[jb+1]=='\0'){jb=b.length()-1;xb=1;} else {jb=i;}
        if (c[jc+1]=='\0'){jc=c.length()-1;xc=1;} else {jc=i;}
    if (x==1){
        if (b[jb]>c[jc]){
            sum = a + b + c;
            bul=0;
        }
        else if (c[jc]>b[jb]) {
            sum = a + c + b;
            bul=0;
        }
        else if (xb==xc) {
            sum = a + b +c;
            bul=0;
        }
    }
    if (x==2){
        if (a[ja]>c[jc]){
            sum = b + a + c;
            bul=0;
        }
        else if (c[jc]>a[ja]){
            sum = b + c + a;
            bul=0;
        }
        else if (xa==xc) {
            sum = b + a + c;
            bul=0;
        }
    }
    if (x==3){
        if (a[ja]>b[jb]){
            sum = c + a + b;
            bul=0;
        }
        else if (b[jb]>a[ja]) {
            sum = c + b + a;
            bul=0;
        }
        else if (xb==xa) {
            sum = c + a + b;
            bul=0;
        }
    }
    }
    cout << sum;
    return 0;
}