#include<stdio.h>
#include<stdlib.h>
                  long a[1000000];
int main(void)
{
        unsigned long n,i,j,k;
        long max1=-30000,max2=-30000,max3=-30000,maxsum=-30000,currentsum=0;
        scanf("%lu",&n);
        for(i=0;i<n;i++) scanf("%ld",&a[i]);
        for(i=0;i<n;i++)if(a[i]>=max1)max1=i;
        for(i=0;i<n;i++)if(a[i]>=max2 && i!=max1)max2=i;
        for(i=0;i<n;i++)if(a[i]>=max3 && i!=max1 && i!=max2)max3=i;
        printf("%ld %ld %ld\n",a[max1],a[max2],a[max3]);
return 0;
}

