#include <iostream>
#include <map>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> m;
int a, b;
while(cin >> a >> b) {
m[a] += b;
}
for(auto it: m) {
cout << it.first << " " << it.second << endl;
}
return 0;
}



京公网安备 11010502036488号