#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using ll = long long;
constexpr int maxn = (ll)2e5 + 5;
constexpr int mod = 998244353;
constexpr int inf = 0x3f3f3f3f;
using namespace std;
void solve() {
  int a, b;
  cin >> a >> b;
  int t = a ^ b;
  cout << t << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
