
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){

  int n,a,b,i;
  vector <int> amo;
  
  cin>>n;

  for(i=0;i<n;i++){
    cin>>a>>b;
    a+=b;
    amo.push_back(a);    
  }
  int test,from;
  while(1){
    test=0;
    from=0;
    sort(amo.begin(),amo.end());
    for(i=0;amo[i]==-1;i++) from++;
    for(i=from;i<amo.size()-1;i++){
      if(amo[i]==amo[i+1]){
        amo[i]=-1;
        amo[i+1]++;
        test++;
      }
    }
    
    if(test==0) break;
    
  }
  
  for(i=from;i<amo.size();i++) cout<<amo[i]<<" 0"<<endl;

  return 0;

}
  

  