#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;
    a[b + c]++;
  }
  for (int i = (0); i < (200005); i++) {
    if (a[i] >= 2) {
      a[i + 1] += a[i] / 2;
      a[i] = a[i] % 2;
    }
  }
  for (int i = (0); i < (200005); i++) {
    if (a[i]) cout << i << " " << 0 << endl;
  }
}
