#include <bits/stdc++.h>
using namespace std;
__attribute__((constructor)) void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main() {
  int n;
  cin >> n;
  int a[200005] = {};
  for (int i = (0); i < (n); i++) {
    int b, c;
    cin >> b >> c;
    if (a[b + c])
      a[b + c] = 0, a[b + c + 1] = 1;
    else
      a[b + c] = 1;
  }
  for (int i = (0); i < (200005); i++) {
    if (a[i]) cout << i << " " << 0 << endl;
  }
}
