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