#include <iostream>
using namespace std;
int main() {
int n, val;
cin >> n;
int max1, max2 , max3;
max1 = max2 = max3 = 0;
for(int i = 0; i < n; i++){
cin >> val;
if(val > max1) {
max3 = max2;
max2 = max1;
max1 = val;
}
else if(val > max2){
max3 = max2;
max2 = val;
}
else if(val > max3)
max3 = val;
}
cout << max3 <<" " << max2 <<" "<< max1;
return 0;
}