#include <bits/stdc++.h>
long double fact(int N) {
  if (N < 0) return 0;
  if (N == 0)
    return 1;
  else
    return N * fact(N - 1);
}
long unsigned long T, n, k, temp_n, i, a, b, c, d, fl_check, j, i_check,
    j_check, cnt_cneck_max, min, temp_min;
unsigned int res, x, m;
long int mas_n[200000], sum, buf;
float mant;
bool fl;
void swap(long int* a, int i, int j) {
  int s = a[i];
  a[i] = a[j];
  a[j] = s;
}
bool NextSet(long int* a, int n) {
  int j = n - 2;
  while (j != -1 && a[j] >= a[j + 1]) j--;
  if (j == -1) return false;
  int k = n - 1;
  while (a[j] >= a[k]) k--;
  swap(a, j, k);
  int l = j + 1, r = n - 1;
  while (l < r) swap(a, l++, r--);
  return true;
}
int comp2(const void* a, const void* b) { return (*(int*)b - *(int*)a); }
int comp1(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int main() {
  std::cin >> T;
  res = 0;
  fl = false;
  temp_n = T;
  while (T--) {
    min = 0xFFFFFFFF;
    std::cin >> a;
    std::cin >> b;
    if (a >= b)
      i = a;
    else
      i = b;
    temp_min = (4925 ^ 2912);
    min = (a ^ i) + (b ^ i);
    res = min;
    std::cout << res;
    std::cout << "\n";
  }
}
