#include using namespace std; int main(){ int n; cin >> n; map m; for(int i=0; i> img >> num >> point; for(int i=0; i> s; m[s] += point; } } vector> v; for(auto p :m) v.push_back(make_pair(p.second, p.first)); sort(v.rbegin(), v.rend()); for(int i=0; i<10; i++){ if(v.size() <= i) break; else cout << v[i].second << " " << v[i].first << endl; } return 0; }