#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

bool cmp(string m, string n)
{
    int i=0;
    while(i < n.length() && m[i]==n[i])
    {
        i++;
    }
    if(i==m.length()) return true;
    else
    {
        if(m[i]>n[i]) return true;
        else return false;
    }
}


int main()
{
    string a,b,c;
    cin >> a >> b >> c;
    vector<string> d(6);
    d[0]=a+b+c;
    d[1]=a+c+b;
    d[2]=b+a+c;
    d[3]=b+c+a;
    d[4]=c+a+b;
    d[5]=c+b+a;
    sort(d.begin(),d.end(),cmp);
    cout << d[0];
}