#include <bits/stdc++.h>
using namespace std;
int input() {
  int res = 0;
  char c = ' ';
  while (c < '0') c = getchar();
  while (c >= '0') res = res * 10 + (c - '0'), c = getchar();
  return res;
}
const int N = 3e5 + 100, C = 30;
int cnt[N * C], ptr[N * C][2], leaf;
void ch(int x, int hw) {
  int c = 0;
  bool v;
  for (int i = C; i >= 0; --i) {
    v = x & (1 << i);
    if (!ptr[c][v]) ptr[c][v] = ++leaf;
    c = ptr[c][v];
    cnt[c] += hw;
  }
}
int mn(int x) {
  int c = 0, res = 0;
  bool v;
  for (int i = C; i >= 0; --i) {
    v = x & (1 << i);
    if (v) {
      if (ptr[c][1] && cnt[ptr[c][1]]) {
        res |= (1 << i);
        c = ptr[c][1];
      } else {
        c = ptr[c][0];
      }
    } else {
      if (ptr[c][0] && cnt[ptr[c][0]]) {
        c = ptr[c][0];
      } else {
        res |= (1 << i);
        c = ptr[c][1];
      }
    }
  }
  return res;
}
int a[N], p[N], o[N];
int main() {
  int n = input();
  for (int i = 0; i < n; ++i) a[i] = input();
  for (int i = 0; i < n; ++i) ch(p[i] = input(), 1);
  for (int i = 0; i < n; ++i) {
    int res = mn(a[i]);
    ch(res, -1);
    o[i] = a[i] ^ res;
  }
  for (int i = 0; i < n; ++i) cout << o[i] << " ";
}
