#include <iostream>
#include <string>
#include <algorithm>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;

bool veci(string a,string b)
{
	int i,l1=a.length(),l2=b.length(),m;
	m=max(l1,l2);
	for(i=0;i<m;i++)
	{
		if(a[i%l1]>b[i%l2]) return true;
		if(a[i%l1]<b[i%l2]) return false;
	}
	return true;
}

int main(int argc, char** argv) {
	string s[3];
	cin>>s[0]>>s[1]>>s[2];
	if(veci(s[2],s[1])) swap(s[2],s[1]);
	if(veci(s[1],s[0])) swap(s[1],s[0]);
	if(veci(s[2],s[1])) swap(s[2],s[1]);
	cout<<s[0]<<s[1]<<s[2]<<endl;
	return 0;
}