#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  const int M = 300000;
  int d[M] = {};
  for (int i = 0; i < N; ++i) {
    int a, b;
    cin >> a >> b;
    ++d[a + b];
  }
  for (int i = 0; i < M; ++i) {
    if (d[i] & 1) cout << i << " " << 0 << endl;
    if (1 < d[i]) ++d[i + (d[i] / 2)];
  }
}
