#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using ld = long double;
const ll mod = (ll)1e9 + 7;
const ll mxN = (ll)1e3 + 3;
ll get(ld d) {
  ld ans = (sqrtl(1 + 8 * d) + 1) / 2;
  return ceil(ans) - 1;
}
void solve() {
  ll a, b;
  cin >> a >> b;
  ll x = (a & b);
  cout << (a ^ x) + (b ^ x) << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(20);
  cout << fixed;
  ll t;
  cin >> t;
  while (t--) solve();
}
