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