var data = require('fs').readFileSync('/dev/stdin', 'utf8');
var input = data.split('\n');

function quickSort(arr) {
	if (arr.length <= 1) {
		return arr;
	}

	var pivot = arr.pop();
	var left = [];
	var right = [];

	while (arr.length) {
		var elem = arr.pop();
		if (elem > pivot) {
			left.push(elem);
		} else {
			right.push(elem);
		}
	}

	return [].concat(quickSort(left), pivot, quickSort(right)).splice(0, 3);
}

console.log(quickSort(input).join('\n'))