#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main () {

  int n;
  
  while(scanf("%d", &n) && n) {
    bitset<32> bs,a,b;
    bs = n;
    int cont = 0;
    for(int i = 0; i < 32; i++) {
      if(bs.test(i)) {
        if(cont%2) b.set(i);
        else a.set(i);
        cont++;
      }
    }
    //int x = a;
    printf("%u %u\n", a.to_ulong(), b.to_ulong());
  }  
  
  return 0;    
}
