#include <bits/stdc++.h>
using namespace std;

#define long int64_t
#define endl '\n'

#ifdef OFFLINE
	#define logan(...) logg(#__VA_ARGS__, __VA_ARGS__)
	template<class Arg>
	void logg(const char* name, Arg&& arg){ cerr << name << ": " << arg << '\n'; }
	template<class Arg, class ... Args>
	void logg(const char* name, Arg&& arg, Args&& ... args){
		const char* next = strchr(name+1, ',');
		cerr.write(name, next-name) << ": " << arg << ",";
		logg(next+1, args...);
	}
	#define timeme 1.0*clock()/CLOCKS_PER_SEC
#else
	#define logan(...) {}
	#define timeme {}
#endif

string& smax(string& a, string&b){
	int n = a.length();
	for(int i = 0; i < n; ++i){
		if(a[i] == b[i]) continue;
		return (a[i] > b[i] ? a : b);
	}
	return a;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	string a, b, c; cin >> a >> b >> c;

	string t1 = a+b+c;
	string t2 = a+c+b;
	string t3 = b+a+c;
	string t4 = b+c+a;
	string t5 = c+a+b;
	string t6 = c+b+a;

	string res = t1;
	res = smax(res, t2);
	res = smax(res, t3);
	res = smax(res, t4);
	res = smax(res, t5);
	res = smax(res, t6);

	cout << res << endl;

}