#include <bits/stdc++.h>
using namespace std;
void fast(void) __attribute__((constructor));
void fast(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
void solve() {
  long long a, b;
  cin >> a >> b;
  long long x = a & b;
  cout << (a ^ x) + (b ^ x);
}
signed main(void) {
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
