#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
vector<long long> prime;
bool mark[100000000];
long long isprime(long long n) {
  if (n < 2) return 0;
  for (long long p = 2; p * p <= n; p++) {
    if (n % p == 0) return false;
  }
  return true;
}
long long vec[100001];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t, cnt = 1;
  long long i, a, ay, bx, by, c, cy, dx, dy, b, x, y, add = 0, j, k, p, r, R;
  string str;
  long long n, value = 0, sum = 0;
  long long q, l, m;
  bool ok = true;
  cin >> t;
  while (t--) {
    long long mx = 1e9 + 7;
    cin >> a >> b;
    cout << (a ^ b) << endl;
  }
  return 0;
}
