#include <bits/stdc++.h>
using namespace std;
int a[300300];
int p[300300];
int g[300300 * 30][2];
int cnt[300300 * 30][2];
void dfs(int v, int a, int d) {
  if (d < 0) {
    printf("%d ", a);
    return;
  }
  int qwe = (a >> d) & 1;
  if (cnt[v][qwe] == 0) {
    qwe = !qwe;
  }
  a ^= (qwe << d);
  dfs(g[v][qwe], a, d - 1);
  cnt[v][qwe]--;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int v = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    int s = 0;
    for (int j = 30; j >= 0; j--) {
      int qwe = ((p[i]) >> j) & 1;
      if (cnt[s][qwe] == 0) {
        v++;
        g[s][qwe] = v;
      }
      cnt[s][qwe]++;
      s = g[s][qwe];
    }
  }
  for (int i = 0; i < n; i++) {
    dfs(0, a[i], 30);
  }
  return 0;
}
