#include <bits/stdc++.h>
using namespace std;
const int N = 3E5 + 4;
int a[N];
int trie[N * 30][2], num[N * 30];
int pos = 1;
void insert(int x) {
  int c = 0;
  for (int i = 30; i >= 0; --i) {
    int d = (x >> i) & 1;
    if (trie[c][d] == 0) {
      trie[c][d] = pos++;
    }
    c = trie[c][d];
    num[c]++;
  }
}
int pow(int a, int b) {
  int res = 1;
  for (int i = 1; i <= b; ++i) res = res * a;
  return res;
}
int Find(int x) {
  int c = 0;
  int bit[33], b = 0;
  for (int i = 30; i >= 0; --i) {
    int d = (x >> i) & 1;
    if (d && num[trie[c][1]]) {
      num[trie[c][1]]--;
      c = trie[c][1];
      bit[b++] = d;
    } else if (d == 0 && num[trie[c][d]]) {
      num[trie[c][0]]--;
      c = trie[c][d];
      bit[b++] = d;
    } else {
      num[trie[c][!d]]--;
      c = trie[c][!d];
      bit[b++] = !d;
    }
  }
  int res = 0;
  for (int i = b - 1; i >= 0; --i) {
    if (bit[i]) res += pow(2, b - 1 - i);
  }
  return res;
}
int main() {
  int n, x;
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  for (int i = 0; i < n; ++i) scanf("%d", &x), insert(x);
  for (int i = 0; i < n; ++i) {
    printf("%d%c", a[i] ^ Find(a[i]), i == n - 1 ? '\n' : ' ');
  }
  return 0;
}
