#include <bits/stdc++.h>
using namespace std;
const int N = (int)4e6 + 7;
const long long MOD = (long long)1e9 + 7;
const int inf = (int)1e9 + 7;
const long long INF = (long long)1e18 + 7;
long long t[N][2], cnt[N], a[N], p[N], sz;
long long n;
void add(long long mask) {
  long long v = 0;
  for (long long i = 30; i >= 0; --i) {
    bool bit = ((1ll << i) & mask);
    if (!t[v][bit]) {
      sz++;
      t[v][bit] = sz;
    }
    v = t[v][bit];
    cnt[v]++;
  }
}
void del(long long mask) {
  long long v = 0;
  for (long long i = 30; i >= 0; --i) {
    bool bit = ((1ll << i) & mask);
    v = t[v][bit];
    cnt[v]--;
  }
}
long long get(long long mask) {
  long long v = 0, ans = 0, cur = (1ll << 30);
  for (long long i = 30; i >= 0; --i) {
    bool bit = (mask >> i & 1ll);
    if (t[v][bit] > 0 && cnt[t[v][bit]] > 0) {
      v = t[v][bit];
      if (bit) ans += cur;
    } else {
      if (bit == 0) {
        ans += cur;
      }
      v = t[v][1 - bit];
    }
    cur /= 2;
  }
  return ans;
}
void solve() {
  cin >> n;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long i = 1; i <= n; ++i) {
    cin >> p[i];
    add(p[i]);
  }
  for (long long i = 1; i <= n; ++i) {
    long long first = get(a[i]);
    cout << (a[i] ^ first) << ' ';
    del(first);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int test = 1;
  for (int i = 1; i <= test; i++) {
    solve();
  }
  return 0;
}
