#include <stdio.h>

int main ()
{
    int a[10], i, j, temp, t;
    scanf ("%d", &t);
    while (t--){
    for (i=0; i<10; i++){
        scanf("%d", &a[i]);
    }
    for (i=0; i<10; i++){
        for (j=i+1; j<10; j++){
            if (a[i]<a[j])
            {
                temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
        }
    }

        printf("%d\n", a[0]);
        printf("%d\n", a[1]);
        printf("%d\n", a[2]);
    }

    return 0;
}

