#include <bits/stdc++.h>
using namespace std;
void solve() {
  long int a, b;
  cin >> a >> b;
  long int res = a ^ b;
  cout << res << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
