#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d,e,f,g,h;
    cin>>a>>b;
    c=a/100;
 
    cout<<endl;
    d=b/100;
 
    
    if(c==d){
        cout<<c<<d;
    }
    
    else if(c>d){
        cout<<c;
    }
    else
    cout<<d<<endl;
    e=(a-(c*100))/10;
    f=(b-(d*100))/10;
    if(e==f){
        cout<<e<<f;
    }
    
    else if(e>f){
        cout<<e;
    }
    else
    cout<<f;
    
    
    g=a-c*100-e*10;
    h=b-d*100-f*10;
    if(g==h){
        cout<<g<<h;
    }
    
    else if(g>h){
        cout<<g;
    }
    else
    cout<<h;
    return 0;
}