#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 1;
int a, b;
void solve() {
  cin >> a >> b;
  int x = 1;
  for (int i = 0; i < 32; i++) {
    if ((a & x) && (b & x)) {
      a ^= x;
      b ^= x;
    }
    x *= 2;
  }
  cout << (a + b) << "\n";
  return;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
