#include <iostream>

using namespace std;

string maks(string a, string b) {
    int c = 0;
    while (true) {
        if (c > a.length()) {
            return a;
        }
        if (a[c] > b[c]) {
            return a;
        }
        else if (a[c] < b[c]) {
            return b;
        }
        else {
            c++;
        }
    }
}

int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    string s1 = a + b + c;
    string s2 = a + c + b;
    string s3 = b + a + c;
    string s4 = b + c + a;
    string s5 = c + a + b;
    string s6 = c + b + a;
    string r1 = maks(s1, s2);
    string r2 = maks(s3, s4);
    string r3 = maks(s5, s6);
    string r4 = maks(r1, r2);
    string r = maks(r3, r4);
    cout << r;
}