#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N, T;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> T;
string s;
int cnt;
while(T--){
cin >> N;
vector<pair<int, string>> V;
for(int i=0; i<N; i++){
cin >> s >> cnt;
V.push_back({cnt, s});
}
sort(V.begin(), V.end(), greater<>());
cout << V.front().second << "\n";
}
return 0;
}
'알고리즘' 카테고리의 다른 글
[알고리즘] 백준 1022 - 소용돌이 예쁘게 출력하기 (0) | 2024.08.04 |
---|---|
[알고리즘] 백준 2467 - 용액 (0) | 2024.08.03 |
[알고리즘] 백준 10942 - 팰린드롬? (0) | 2024.08.01 |
[알고리즘] 백준 2636 - 치즈 (0) | 2024.07.31 |
[알고리즘] 백준 1339 - 단어 수학 (0) | 2024.07.31 |