#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
static const auto _____ = []() {
  ios::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(0);
  return 0;
}();
int mpow(int base, int exp) {
  base %= 1000000007;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long int)result * base) % 1000000007;
    base = ((long long int)base * base) % 1000000007;
    exp >>= 1;
  }
  return result;
}
long long int gcdExtended(long long int a, long long int b, long long int *x,
                          long long int *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long int x1, y1;
  long long int gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long int modInverse(long long int b, long long int m) {
  long long int x, y;
  long long int g = gcdExtended(b, m, &x, &y);
  if (g != 1) return -1;
  return (x % m + m) % m;
}
struct st {
  int a, b;
};
bool sortfunc(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
long long int gcd(long long int a, long long int b) {
  return (b == 0) ? a : gcd(b, a % b);
}
int dx[] = {0, 1, -1, 0};
int dy[] = {-1, 0, 0, 1};
void testcase() {
  long long int a, b;
  cin >> a >> b;
  long long int c = (a xor (a & b)) + (b xor (a & b));
  cout << c << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    testcase();
  }
  return 0;
}
