#include <bits/stdc++.h>
using namespace std;
int findBits(int x, int y) { return (x | y) - (x & y); }
int main() {
  int t;
  cin >> t;
  while (t--) {
    int x;
    int y;
    cin >> x >> y;
    int w = (findBits(x, y));
    cout << w << endl;
  }
  return 0;
}
