#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e9;
const long long MOD = 1e9 + 7;
const long long pi = 3.1415926535897933846;
long long t, sum, best, worst, len, k, l, m, r, g, n, q, w, x, y, z, i, j, p;
vector<pair<long long, long long>> vp;
set<long long> sl;
unordered_map<long long, bool> bool_map;
vector<long long> v;
long long c[1000005];
long long dp[1000005] = {0};
string s;
long long seg[1000005] = {0};
long long prime[1000005] = {0};
void solve() {
  int x, y;
  cin >> x >> y;
  cout << (x ^ y) << "\n";
}
int main() {
  { ios_base::sync_with_stdio(false); }
  {
    cin.tie(NULL);
    cout.tie(NULL);
  }
  cin >> t;
  while (t--) solve();
}
