#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
const long long inf = 92233720368547758;
bool isprime(long long n) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
long long fpow(long long a, long long b) {
  return b ? fpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long inv(long long i) {
  if (i == 1) return 1;
  return (mod - ((mod / i) * inv(mod % i)) % mod) % mod;
}
long long dtb(long long x) {
  long long ans = 0;
  long long y = 1;
  while (x > 0) {
    ans += (x % 2) * y;
    x = x / 2;
    y = y * 10;
  }
  return ans;
}
vector<long long> adj[300009], vis(500009, 0), adjr[100009], col(200009, 0);
bool cmp(string x, string y) { return x.size() < y.size(); }
void solve() {
  long long x, y;
  cin >> x >> y;
  cout << (x ^ y) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  auto start = std::chrono::high_resolution_clock::now();
  long long T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
  auto stop = std::chrono::high_resolution_clock::now();
  auto duration =
      std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);
}
