#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 200;
int tot, chd[maxn * 30][2];
int a[maxn];
int ans[maxn * 30];
void Insert(int x) {
  int num[35] = {0}, len = 0;
  while (x > 0) {
    num[len++] = x % 2;
    x >>= 1;
  }
  int cur = 0;
  for (int i = 31; i >= 0; i--) {
    int p = num[i];
    if (chd[cur][p] == 0) {
      tot++;
      chd[cur][p] = tot;
    }
    cur = chd[cur][p];
    ans[cur]++;
  }
}
void find(int x) {
  int m = x;
  int num[35] = {0}, len = 0;
  while (x > 0) {
    num[len++] = x % 2;
    x >>= 1;
  }
  int cur = 0, cnt = 0;
  for (int i = 31; i >= 0; i--) {
    int p = num[i];
    if (ans[chd[cur][p]]) {
      ans[chd[cur][p]]--;
      cnt = cnt * 2;
      cur = chd[cur][p];
    } else {
      ans[chd[cur][1 - p]]--;
      cnt = cnt * 2 + 1;
      cur = chd[cur][1 - p];
    }
  }
  printf("%d ", cnt);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    Insert(x);
  }
  for (int i = 0; i < n; i++) find(a[i]);
  return 0;
}
