#include <bits/stdc++.h>
using namespace std;
const int maxn = 6e6 + 10;
int n, m, zi[maxn][3], id, isok[maxn], cnt[maxn][3], a[maxn];
bool ok[maxn];
void insert(int x) {
  int now = 0;
  for (int i = 30; i >= 0; i--) {
    int w = ((x >> i) & 1);
    if (!zi[now][w]) zi[now][w] = ++id;
    cnt[now][w]++;
    now = zi[now][w];
  }
}
int ask(int x) {
  int ans = 0, now = 0;
  for (int i = 30; i >= 0; i--) {
    int w = ((x >> i) & 1), x;
    if (zi[now][w]) {
      cnt[now][w]--;
      x = zi[now][w];
      if (cnt[now][w] == 0) zi[now][w] = 0;
    } else {
      cnt[now][w ^ 1]--;
      x = zi[now][w ^ 1];
      ans += (1 << i);
      if (cnt[now][w ^ 1] == 0) zi[now][w ^ 1] = 0;
    }
    now = x;
  }
  return ans;
}
signed main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    insert(x);
  }
  for (int i = 1; i <= n; i++) printf("%d ", ask(a[i]));
}
