#include <iostream>
#include <string>

using namespace std;

int veci(string a, string b)
{
	int i = 0, najveci = 0;
	
	while(i < a.size() && najveci == 0)
	{
		if(a[i] == b[i])
		{
			i++;
		}
		else if(a[i] > b[i])
		{
			najveci = 1;
		}
		else if(a[i] < b[i])
		{
			najveci = 2;
		}
	}
	
	return najveci;
}

int main(){
	
	string a, b, c, str1, str2, str3, str4, str5, str6, max;
	
	cin >> a>> b >>c;
	
	str1 = a + b + c;
	str2 = a + c + b;
	str3 = b + a + c;
	str4 = b + c + a;
	str5 = c + a + b;
	str6 = c + b + a;
	
	max = str1;
	
	if(veci(max, str2) == 2)
	{
		max = str2;
	}
	else if(veci(max, str3) == 2)
	{
		max = str3;
	}
	else if(veci(max, str4) == 2)
	{
		max = str4;
	}
	else if(veci(max, str5) == 2)
	{
		max = str5;
	}
	else if(veci(max, str6) == 2)
	{
		max = str6;
	}
	
	cout << max;
	
	return 0;
}