#include <iostream>

using namespace std;

int la, lb, lc;

bool veci(string a, string b){
    for (int i=0; i<la+lb+lc; ++i){
        if (a[i]>b[i])
            return true;
        if (a[i]<b[i])
            return false;
    }
}

int main()
{
    string a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;
    la=a.size();
    lb=b.size();
    lc=c.size();
    string tren, maxs;
    maxs=a+b+c;
    if (veci(a+c+b, maxs)){
        maxs=a+c+b;
    }
    if (veci(b+a+c, maxs)){
        maxs=b+a+c;
    }
    if (veci(b+c+a, maxs)){
        maxs=b+c+a;
    }
    if (veci(c+a+b, maxs)){
        maxs=c+a+b;
    }
    if (veci(c+b+a, maxs)){
        maxs=c+b+a;
    }
    cout << maxs;
    return 0;
}