#include <bits/stdc++.h>
using namespace std;
long long mxn = -1 * 2e12, miin = 2e12;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long x = max(a, b);
    long long cnt = a ^ x;
    a = b ^ x;
    cout << cnt + a << endl;
  }
}
