#include <bits/stdc++.h>

using namespace std;

int main()
{
    string a, b, c;
    cin>>a>>b>>c;
    int a_og_length = a.length();
    int b_og_length = b.length();
    int c_og_length = c.length();


    a.insert(a.end(), 18-a.length(), '0');
    b.insert(b.end(), 18-b.length(), '0');
    c.insert(c.end(), 18-c.length(), '0');

    //pos, 0 = a, 1 = b, 2 = c

    int pos[3] = {0};

    char chosen;

    for(int i = 0;i<18;i++){
        int maxab = max(a[i]-'0', b[i]-'0');
        int maxac = max(a[i]-'0', c[i]-'0');
        int maxbc = max(b[i]-'0', c[i]-'0');


        if(c[i]-'0'>maxab){
            pos[0] = 2;
            chosen = 'c';
            break;


        }
        if(b[i]-'0'>maxac){
            pos[0] = 1;
            chosen = 'b';
            break;
        }
        if(a[i]-'0'>maxbc){
            pos[0] = 0;
            chosen = 'a';
            break;
        }

    }

    for(int  i = 0;i <18;i++){
        int maxab = max(a[i]-'0', b[i]-'0');
        int maxac = max(a[i]-'0', c[i]-'0');
        int maxbc = max(b[i]-'0', c[i]-'0');
        if(chosen == 'a'){
                if(b[i]-'0' > c[i]-'0')
                {
                    pos[1] = 1;
                    break;
                }
                else if (b[i]-'0' < c[i]-'0'){
                    pos[1] = 2;
                    break;
                }
                break;
        }
        if(chosen == 'b'){
                if(a[i]-'0' > c[i]-'0')
                {
                    pos[1] = 0;
                    break;
                }
                else if (a[i]-'0' < c[i]-'0'){
                    pos[1] = 2;
                    break;
                }
        }
        if(chosen == 'c'){
                if(b[i]-'0' > a[i]-'0')
                {
                    pos[1] = 1;
                    break;
                }
                else if(b[i]-'0' < a[i]-'0'){
                    pos[1] = 0;
                    break;
                }
        }
        }

    pos[2] = 3-pos[0]-pos[1];
    string r;
    a = a.substr(0, a_og_length);
    b = b.substr(0, b_og_length);
    c = c.substr(0, c_og_length);
    for(int i = 0;i<3;i++){
        if(pos[i] == 0)
            r.append(a);
        if(pos[i] == 1)
            r.append(b);
        if(pos[i] == 2)
            r.append(c);
    }
    cout<<r;

}