#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, t;
  cin >> t;
  while (t > 0) {
    cin >> a >> b;
    int c = a ^ b;
    std::cout << c << std::endl;
    t--;
  }
  return 0;
}
