#include #include using namespace std; int n; struct node { string s; int val; bool operator<(const node &t) const { if(s==t.s) return val>t.val; return s>T; while(T--) { cin>>n; for(int i=0;i>a[i].s>>a[i].val; sort(a,a+n); int ans=0; string rep; for(int i=0,time=0;i