#include #include #include #include #include #include #include #include #include #include #include #define mod 1000000007 #define MAXN 200010 #define INIF 2147483646 #define inf 0x3f3f3f3f //#define ll long long using namespace std; //typedef __int64 ll; struct course { string s; int v; }c[110]; int cmp(course a,course b){ if(a.s!=b.s) return a.sb.v; } int main() { //freopen("F://in.txt","r",stdin); int T; scanf("%d",&T); while(T--){ int n; scanf("%d",&n); for(int i=0;i>c[i].s; scanf("%d",&c[i].v); } sort(c,c+n,cmp); int ans=0; map m; for(int i=0;i