#include #include #include #include #include #include using namespace std; int main(){ int n,x,M,S; string tag; map cnt; cin >> n; for(int i=0;i> x >> M >> S; while(M--){ cin >> tag; cnt[tag] += S; } } vector> v; for(auto au:cnt){ v.emplace_back(-au.second,au.first); } sort(v.begin(),v.end()); n=min(10,int(v.size())); for(int i=0;i