#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const double eps = 1e-8;
const int maxn = 1e6 + 5;
const int INF = 1e9;
const int maxnode = 7e6 + 5;
const int sigma_size = 2;
void tran2(int num, int s[]) {
  for (int i = 0; i < 31; i++) {
    s[i] = (num >> (30 - i)) & 1;
  }
}
struct Trie {
  int ch[maxnode][sigma_size];
  int val[maxnode], able[maxnode];
  int sz;
  void init() {
    sz = 1;
    memset(ch, 0, sizeof(ch));
    memset(val, 0, sizeof(val));
    memset(able, 0, sizeof(able));
  }
  int idx(int c) { return c; }
  void insert(int *s) {
    int u = 0, n = 31;
    for (int i = 0; i < n; i++) {
      able[u]++;
      int c = idx(s[i]);
      if (!ch[u][c]) {
        val[sz] = 0;
        ch[u][c] = sz++;
      }
      u = ch[u][c];
    }
    able[u]++;
    val[u]++;
  }
  void del(int *s) {
    int u = 0, n = 31;
    for (int i = 0; i < n; i++) {
      able[u]--;
      int c = idx(s[i]);
      u = ch[u][c];
    }
    able[u]--;
    val[u]--;
  }
  int find_min(int *s) {
    int u = 0, i = 1, num = 0;
    int k = 0;
    int r = 0;
    for (k = 0; k < 31; k++) {
      int y = idx(s[k]);
      int x = y ^ 1;
      able[u]--;
      if (ch[u][y] && able[ch[u][y]] > 0) {
        u = ch[u][y];
      } else {
        r += 1 << (30 - k);
        u = ch[u][x];
      }
    }
    able[u]--;
    val[u]--;
    return r;
  }
} trie;
int a[maxn], p[maxn], n, s[maxn];
int main(void) {
  scanf("%d", &n);
  trie.init();
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    tran2(p[i], s);
    trie.insert(s);
  }
  int tmp;
  for (int i = 0; i < n; i++) {
    tran2(a[i], s);
    tmp = trie.find_min(s);
    printf("%d ", tmp);
  }
  return 0;
}
