#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
long long power(long long x, long long y) {
  if (y == 0)
    return 1;
  else if (y == 1)
    return x;
  long long r = power(x, y / 2);
  if (y % 2 == 0)
    return (r * r);
  else
    return (r * r * x);
}
bool primechecker(long long i) {
  bool valid = true;
  for (int j = 2; j <= sqrt(i); j++) {
    if (i % j == 0) {
      valid = false;
      break;
    }
  }
  if (valid && i != 1)
    return true;
  else
    return false;
}
vector<bool> prime(10000001, true);
void sieveprime() {
  prime[0] = false;
  prime[1] = false;
  for (int i = 2; i < prime.size(); i++) {
    if (prime[i] == true) {
      for (int j = i + i; j <= 10000000; j += i) prime[j] = false;
    }
  }
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    cout << (a ^ b) << "\n";
  }
  return 0;
}
