#include <bits/stdc++.h>
#define endl '\n'
using namespace std;



bool cmp(string a, string b) {
	int m = max(a.size(), b.size());

	for (int i = 0; i < m; i++) {
		int x = a[i % a.size()] - b[i % b.size()];

		if (x == 0)
			continue;
		return x > 0;

	}
	return true;
}

int main() {	
	#ifndef ONLINE_JUDGE
	freopen("../in.txt", "r", stdin);
	#endif

	ios_base::sync_with_stdio(0);
	cin.tie(0);

	string a, b, c;

	cin >> a >> b >> c;

	vector <string> v;
	v.push_back(a);
	v.push_back(b);
	v.push_back(c);

	sort(v.begin(), v.end(), cmp);

	
	for (auto x : v) {
		cout << x;
	}

	cout << endl;

	return 0;
}