/*
#include <stdio.h>
#include <string.h>
int main()
{
int i;
char str[21]={};
scanf("%s",&str);
for(i=0 ; str[i]!=NULL ; i++)
{
printf("'%c'",str[i]);
printf("\n");
}
}
#include <stdio.h>
#include <string.h>
int main()
{
int i;
char str[11]={};
scanf("%s",&str);
printf("welcome! ");
for(i=0 ; str[i]!=NULL ; i++)
{
printf("%c",str[i]);
}
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
int i,a;
char str[21]={};
scanf("%s",str);
for(i=0; str[i]!=NULL ; i++)
{
a=str[i];
printf("%c",str[i]+2);
}
printf(" ");
for(i=0 ; str[i]!=NULL ; i++)
{
printf("%c",(str[i]*7)%80+48);
}
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
int i,a=0,b=0;
char str[101]={};
scanf("%s",str);
for(i=0 ; i<strlen(str); i++)
{
if(str[i]=='c'||str[i]=='C')
{
a=a+1;
}
if((str[i]=='c'||str[i]=='C')&&(str[i+1]=='c'||str[i+1]=='C'))
{
if(str[i+1]==NULL)
{
break;
}
b=b+1;
}
}
printf("%d",a);
printf("\n");
printf("%d",b);
return 0;
}
*/
#include <stdio.h>
#include <string.h>
void f(int i)
{
for(i=0 ; str1[i]!=NULL ; i++)
{
printf("%d",str1[i]);
}
printf(" ");
for(i=0 ; str2[i]!=NULL ; i++)
{
printf("%d",str2[i]);
}
}
void g(int i)
{
for(i=0 ; str2[i]!=NULL ; i++)
{
printf("%d",str2[i]);
}
printf(" ");
for(i=0 ; str1[i]!=NULL ; i++)
{
printf("%d",str1[i]);
}
}
int main()
{
int i,a=0,b=0;
char str1[101]={};
char str2[101]={};
scanf("%s",str1);
scanf("%s",str2);
for(i=0 ; str1[i]!=NULL ; i++)
{
a=a+1;
}
for(i=0 ; str2[i]!=NULL ; i++)
{
b=b+1;
}
if(a>b)
{
g();
}
else if(a<b)
{
f();
}
else if(a==b)
{
for(i=0 ; i<=101 ; i++)
{
if(str1[i]>str2[i])
{
g();
}
else if(str1[i]<str2[i])
{
f();
}
}
}
return 0;
}



