#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, t, i, j, ans;
  cin >> t;
  while (t--) {
    ans = 0;
    cin >> a >> b;
    i = a & b;
    ans = (a ^ i) + (b ^ i);
    cout << ans << endl;
  }
  return 0;
}
