#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    int i, j, k, s = 0, a, b, x = 0;
    cin >> a >> b;
    s = a ^ x + b ^ x;
    cout << s << endl;
  }
  return 0;
}
