#include <stdio.h>

int main() {
    int num = 0;
    int arr[100] = {0};
    while (scanf("%d", &num) != EOF) 
    { 
        for (int i = 0; i < num; i++)
        {
            scanf("%d",arr+i);
        }
        for (int i = 0; i < num; i++)
        {
            for (int j = 0; j < num - i - 1; j++)
            {
                if (arr[j] > arr[j+1])
                {
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        for (int i = 0; i < 5; i++)
        {
            printf("%d ",arr[--num]);
        }
    }
    return 0;
}