#include #include #include using namespace std; int main() { int key, value; map<int, int> res; int i; cin >> i; while (i--) { cin >> key >> value; res[key] += value; } for (auto c = res.begin(); c != res.end(); c++) {

    if (c->second != 0) {
        cout << c->first << ' ' << c->second << endl;
    }
}
return 0;

}