#include <bits/stdc++.h>
using namespace std;
const long long int N = 10000;
int p[N];
bool prime(long long int n) {
  if (n < 2) return false;
  for (long long int x = 2; x * x <= n; x++) {
    if (n % x == 0) return false;
  }
  return true;
}
long long int largestDigit(long long int n) {
  long long int largest = 0;
  while (n) {
    long long int r = n % 10;
    largest = max(r, largest);
    n = n / 10;
  }
  return largest;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int calcPow(long long int n, long long int y) {
  long long int pro = 1;
  for (long long int j = 1; j <= y; j++) {
    pro = pro * n;
  }
  return pro;
}
long long int smallestDigit(long long int n) {
  long long int smallest = 10;
  while (n) {
    long long int r = n % 10;
    smallest = min(r, smallest);
    n = n / 10;
  }
  return smallest;
}
int numOfFactors(long long int n) {
  int ans = 1;
  while (n > 1) {
    int prime = p[n], cnt = 1;
    while (n % prime == 0) cnt++, n /= prime;
    ans *= cnt;
  }
  return ans;
}
long long int ceil_div(long long int a, long long int b) {
  return (a + b - 1) / b;
}
long long int setbit(long long int n) {
  if (n == 0) return 0;
  long long int msb = 0;
  n = n / 2;
  while (n != 0) {
    n = n / 2;
    msb++;
  }
  return (1 << msb);
}
long long int cntdigit(long long int n) {
  return (long long int)floor(log10(n) + 1);
}
bool isPowerOf2(int n) {
  if (n == 0) return 0;
  while (n != 1) {
    if (n % 2 != 0) return 0;
    n = n / 2;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  for (int i = 2; i < N; i++) {
    if (p[i]) continue;
    for (int j = i; j < N; j += i) p[j] = i;
  }
  long long int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    long long int k = a ^ b;
    cout << k << "\n";
  }
  return 0;
}
