#include<iostream>
#define f0n for (int i = 0; i < n; i++)
using namespace std;
int main() {
int arr[100], n, maximum = -1e9,max2 = -1e9,max3 = -1e9;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = 0; i < n; i++) {
maximum = max(maximum, arr[i]);
}
for (int i = 0; i < n; i++) {
if (max2 < arr[i] && arr[i] < maximum) {
max2 = arr[i];
}
}
for (int i = 0; i < n; i++) {
if (max3 < arr[i] && arr[i] < max2) {
max3 = arr[i];
}
}
cout << maximum << " " << max2 << " " << max3;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNkZWZpbmUgZjBuIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKQp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpIHsKCWludCBhcnJbMTAwXSwgbiwgbWF4aW11bSA9IC0xZTksbWF4MiA9IC0xZTksbWF4MyA9IC0xZTk7CgljaW4gPj4gbjsKCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CgkJY2luID4+IGFycltpXTsKCX0KCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CgkJbWF4aW11bSA9IG1heChtYXhpbXVtLCBhcnJbaV0pOwoJfQoJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKCQlpZiAobWF4MiA8IGFycltpXSAmJiBhcnJbaV0gPCBtYXhpbXVtKSB7CgkJCW1heDIgPSBhcnJbaV07CgkJfQoJfQoJZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKCQlpZiAobWF4MyA8IGFycltpXSAmJiBhcnJbaV0gPCBtYXgyKSB7CgkJCW1heDMgPSBhcnJbaV07CgkJfQoJfQoJY291dCA8PCBtYXhpbXVtIDw8ICIgIiA8PCBtYXgyIDw8ICIgIiA8PCBtYXgzOwp9