#include using namespace std; using Int = long long; signed main(){ Int n; cin>>n; map mp; for(Int i=0;i>no>>m>>s; string t; for(Int j=0;j>t; mp[t]+=s; } } using P = pair; priority_queue,greater

> pq; for(auto p:mp) pq.emplace(-p.second,p.first); Int x=10; while(!pq.empty()&&x--){ P p=pq.top();pq.pop(); cout<