#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int t;
  cin >> t;
  while (t--) {
    unsigned long long int a, b;
    cin >> a >> b;
    cout << (a ^ b) << endl;
  }
}
