#include <bits/stdc++.h>
using namespace std;
void decToBinary(int n, vector<int> &v) {
  for (int i = 31; i >= 0; i--) {
    int k = n >> i;
    if (k & 1)
      v.push_back(1);
    else
      v.push_back(0);
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int i, a, b, x = 0;
    cin >> a >> b;
    vector<int> v1, v2;
    decToBinary(a, v1);
    decToBinary(b, v2);
    for (i = 0; i < v1.size(); i++) {
      if (v1[i] == 1 && v2[i] == 1) x += pow(2, 31 - i);
    }
    int val = (a ^ x) + (b ^ x);
    cout << val << "\n";
  }
}
