#include <stdio.h>
#include <stdlib.h>

int Veci(int x,int y)
{
    if (x/10==y)
        if(x%10<=y)
            return y;
        else return x;
    return y;
}
int Srednji(int x, int y)
{
     if (x/10==y)
        if(x%10<=y)
            return y;
        else return x;
    
    if(x/10 > y)
     return x;
    else return y;
}
int Manji(int x,int y)
{
    if (x/10==y)
        if(x%10<=y)
            return x;
        else return y;
    if(x/10 >y)
     return y;
    else return x;
}
int main()
{
    int a,b,c;
    int max=0;
    int mid=0;
    int min=0;
    int u;
    scanf("%d%d%d",&a,&b,&c);
    
    if (c<10)
 {
    if (a>=b && a>=c)
            max=a;
        else if (b>=a && b>=c)
            max=b;
        else 
            max=c;
    
    if ((a<=b && b<=c) || (c<=b && b<=a)) 
            mid=b; 
        else if ((b<=a && a<=c) || (c<=a && a<=b)) 
            mid=a; 
        else
            mid=c;
            
    if (a<=b && a<=c)
            min=a;
        else if (b<=a && b<=c)
            min=b;
        else 
            min=c;
     u=max*100+mid*10+min;
 }
 else
    
    {
    if (a>=b && a>=(c/10))
        max=Veci(c,a);
    else if(b>=a && b>=(c/10))
        max=Veci(c,b);
    else max=c;

            
    if ((a<=b && b<=(c/10)) || ((c/10)<=b && b<=a)) 
            mid=Srednji(c,b);

    else if ((b<=a && a<=(c/10)) || ((c/10)<=a && a<=b))
            mid=Srednji(c,a); 
    else
       mid=c;
       
    if (a<=b && a<=(c/10))
        min=Manji(c,a);
    else if (b<=a && b<=(c/10))
        min=Manji(c,b);
    else 
        min=c;

    if(c==max)
        u=max*100+mid*10+min;
    else if(c==mid)
        u=max*1000+mid*10+min;
    else
        u=max*1000+mid*100+min;
    }
printf("%5d%5d%5d\n",max,mid,min);
printf("%d",u);

    return 0;
}