#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  int N;
  cin >> N;
  map<int, int> digit;
  for (int i = 0; i < N; ++i) {
    int a, b;
    cin >> a >> b;
    ++digit[a + b];
  }
  auto i = begin(digit);
  while (i != end(digit)) {
    if (i->second & 1) cout << i->first << " " << 0 << endl;
    if (i->second < 2)
      ++i;
    else {
      auto nex = i->first + (i->second / 2);
      if (digit.count(nex))
        ++digit[nex];
      else
        digit.insert(pair<int, int>(nex, 1));
      ++i;
    }
  }
}
