#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int T1, T2;
    cin >> T1 >> T2;
    int r = T1 | T2;
    r = (T1 ^ r) + (T2 ^ r);
    cout << r << endl;
  }
  return 0;
}
