#include <bits/stdc++.h>
using namespace std;
string a, b, c;
vector <char> x1, x2, x3, x4, x5, x6, m;
bool veci(vector <char> a, vector <char> b)
{
    for(int i = 0; i < (int)a.size(); i++)
    {
        if(a[i] > b[i]) return 1;
        if(a[i] < b[i]) return 0;
    }
    return 0;
}
void Spoji(string x, string y, string z, vector <char> &r)
{
    int i;
    for(i = 0; i < (int)x.size(); i++)
        r.push_back(x[i]);
    for(i = 0; i < (int)y.size(); i++)
        r.push_back(y[i]);
    for(i = 0; i < (int)z.size(); i++)
        r.push_back(z[i]);
}
int main()
{
    cin >> a >> b >> c;
    int i;
    Spoji(a, b, c, x1);
    Spoji(a, c, b, x2);
    Spoji(b, a, c, x3);
    Spoji(b, c, a, x4);
    Spoji(c, a, b, x5);
    Spoji(c, b, a, x6);
    m = x1;
    if(veci(x2, m) == 1)m = x2;
    if(veci(x3, m) == 1)m = x3;
    if(veci(x4, m) == 1)m = x4;
    if(veci(x5, m) == 1)m = x5;
    if(veci(x6, m) == 1)m = x6;
    for(i = 0; i < (int)m.size(); i++) cout << m[i];
    return 0;
}