#include #include #include 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> V; for(int i=0; i> s >> cnt; V.push_back({cnt, s}); } sort(V.begin(), V.end(), greater()); cout