링크 : https://www.acmicpc.net/problem/2693
/*
문제 : N번째 큰 수
링크 : https://www.acmicpc.net/problem/2693
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int N = 0;
cin >> N;
vector<int> v;
for(int i = 0; i < N; i ++){
for(int j =0; j < 10; j ++){
int num = 0;
cin >> num;
v.push_back(num);
}
sort(v.begin(), v.end());
cout << v[7] << '\n';
v.clear();
}
return 0;
}