#include <bits/stdc++.h>
using namespace std;
const int Q = 31;
const int MAXN = 300000 + 10;
const int MAXM = MAXN * Q + 100;
int nxt[MAXM][2];
int cnt[MAXM];
int Word[Q];
int tmp = 0;
void Store() {
  int now = 0;
  cnt[now]++;
  for (int i = 0; i < Q; ++i) {
    if (nxt[now][Word[i]] == -1) nxt[now][Word[i]] = ++tmp;
    now = nxt[now][Word[i]];
    cnt[now]++;
  }
}
int Get() {
  int now = 0;
  cnt[now]--;
  int XOR = 0;
  for (int i = 0; i < Q; ++i) {
    XOR <<= 1;
    if (nxt[now][Word[i]] != -1 && cnt[nxt[now][Word[i]]] > 0)
      now = nxt[now][Word[i]];
    else
      now = nxt[now][1 - Word[i]], XOR++;
    cnt[now]--;
  }
  return XOR;
}
void getW(int X) {
  for (int i = Q - 1; i >= 0; --i) {
    Word[Q - 1 - i] = ((X & (1 << i)) > 0);
  }
}
int A[MAXN];
int B[MAXN];
int main() {
  memset(nxt, -1, sizeof nxt);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int GG;
  for (int i = 0; i < n; ++i) cin >> A[i];
  for (int i = 0; i < n; ++i) cin >> B[i];
  for (int i = 0; i < n; ++i) {
    getW(B[i]);
    Store();
  }
  for (int i = 0; i < n; ++i) {
    getW(A[i]);
    cout << Get() << " ";
  }
  return 0;
}
