#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, res;
  cin >> n;
  int x, y;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    res = (x ^ y);
    cout << res << endl;
  }
  return 0;
}
