#include <bits/stdc++.h>
using namespace std;
multiset<long long> lista[80];
long long suma[80];
long long cant[80][80];
void solve() {
  int a, b;
  cin >> a >> b;
  long long rpta = a ^ b;
  cout << rpta << endl;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
