#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int a, b;
    cin >> a >> b;
    int res = 0;
    for (int i = 31; i >= 0; i--) {
      if ((a >> i & 1) != (b >> i & 1)) res += (1 << i);
    }
    cout << res << endl;
  }
}
