#include<bits/stdc++.h>
using namespace std;
struct MojTip {
    string pr;
    string dr;
};
MojTip poredi(string x, string y) {
    for(int i = 0; i < min(x.length(), y.length()); ++i) {
        if(x[i] > y[i]) {
            MojTip abc;
            abc.pr = x;
            abc.dr = y;
            return abc;
        }
        else if(x[i] < y[i]) {
            MojTip abc;
            abc.pr = y;
            abc.dr = x;
            return abc;
        }

    }
    MojTip abc;
    abc.pr = x;
    abc.dr = y;
    return abc;
}
int main() {
    string a, b, c;
    cin >> a >> b >> c;
    queue<string> q;
    q.push(a); q.push(b); q.push(c);

    string najduza, najkraca;

    najduza = poredi(poredi(a, b).pr, c).pr;
    najkraca = poredi(poredi(a, b).dr, c).dr;


    string srednja;

    int nasao = 0;
    for(int i = 0; i < 3; ++i) {
        if(nasao == 2)
            break;
        if(q.front() == najduza || q.front() == najkraca) {
            ++nasao;
            q.pop();
        }

    }
    srednja = q.front();

    cout << najduza << srednja << najkraca;
}