#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 300000;
int nxt[N * 40][2];
int cnt[N * 40];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, temp = 0;
  cin >> n;
  vector<long long> a(n + 1), p(n + 1), ans(n + 1, 0);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) {
    int ind = 0;
    for (int j = 29; j >= 0; j--) {
      int bit = (p[i] >> j) & 1;
      if (!nxt[ind][bit]) {
        nxt[ind][bit] = ++temp;
      }
      ind = nxt[ind][bit];
      cnt[ind]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    int ind = 0;
    for (int j = 29; j >= 0; j--) {
      int bit = (a[i] >> j) & 1;
      if (!nxt[ind][bit] || !cnt[nxt[ind][bit]]) {
        bit ^= 1;
        ans[i] |= (1 << j);
      }
      ind = nxt[ind][bit];
      cnt[ind]--;
    }
    cout << ans[i] << " ";
  }
}
