#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tes;
  cin >> tes;
  for (int test = 1; test <= tes; test++) {
    long long int n, m;
    cin >> n >> m;
    cout << (n ^ m) << endl;
  }
}
