#include<iostream>
#include<string>
using namespace std;
int main()
{
string a;
string b;
cin >> a >> b;
//report which of the two is larger
if (a == b)
{
cout << a << endl;
cout << b << endl;
}
else if(a > b)
{
cout << a << endl;
}
else
{
cout << b << endl;
}
//report which of the two is longer
if (a == b)
{
cout << a << endl;
cout << b << endl;
}
else if (a.size() > b.size())
{
cout << a << endl;
}
else if(a.size() < b.size())
{
cout << b << endl;
}
return 0;
}