#include <iostream>
using namespace std;
void qs(int*, int);

int main() {
	//int n;
	//cin >> n;
	//int *a=new int[n];
	int a[5];
	for (int i = 0; i < 5; i++) {
		cin >> a[i];
	}
	qs(a, 4);
	for (int i = 4; i > 0; i--)
		cout << a[i] << " ";
	cout << a[0]<<endl;
	return 0;
}


void qs(int *a, int e){
	if (e == 0)
		return;
	int t;
	if (e == 1) {
		if (a[0] > a[1]) {
			t = a[0];
			a[0] = a[1];
			a[1] = t;
		}
		return;
	}
	int p = a[0], lp = -1, rp = e + 1,s=0;
	if (p < a[1])
		p = a[1];
	while (1){
		while (1){
			lp++;
			if (lp == e) {
				qs(a, e - 1);
				return;
			}
			if (lp == rp) {
				s = 2;
				break;
			}
			if (a[lp] >= p)
				break;
		}
		if (s == 0) {
			while (1) {
				rp--;
				if (rp == 0) {
					qs(a + 1, e - 1);
					return;
				}
				if (lp == rp) {
					s = 1;
					break;
				}
				if (a[rp] < p)
					break;
			}
		}
		if (s == 1) {
			qs(a, lp-1);
			qs(a + lp, e - lp);
			return;
		}
		if (s == 2) {
			qs(a, rp - 1);
			qs(a + rp, e - rp);
			return;
		}
		t = a[lp];
		a[lp] = a[rp];
		a[rp] = t;
	}
}
