#include <bits/stdc++.h>
using namespace std;
int trie[2][32 * 300010], cnt[2][32 * 300010], nodes = 1;
int a[300010], p[300010];
void insert(int x) {
  int i, idx = 0;
  for (i = 31; i >= 0; i--) {
    int b = (x >> i) & 1;
    if (trie[b][idx] == 0) {
      trie[b][idx] = nodes;
      nodes++;
    }
    cnt[b][idx]++;
    idx = trie[b][idx];
  }
}
void remove(int x) {
  int i, idx = 0;
  for (i = 31; i >= 0; i--) {
    int b = (x >> i) & 1;
    cnt[b][idx]--;
    idx = trie[b][idx];
  }
}
int minXor(int x) {
  int ret = 0, i, idx = 0;
  for (i = 31; i >= 0; i--) {
    int b = (x >> i) & 1;
    if (cnt[b][idx] == 0) {
      ret |= (1 << i);
      idx = trie[1 - b][idx];
    } else {
      idx = trie[b][idx];
    }
  }
  return ret;
}
int main() {
  int n, i, j, k;
  scanf("%d", &n);
  memset(trie, 0, sizeof(trie));
  memset(cnt, 0, sizeof(cnt));
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  vector<int> ans;
  for (i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    insert(p[i]);
  }
  for (i = 0; i < n; i++) {
    int temp = minXor(a[i]);
    ans.push_back(temp);
    remove(a[i] ^ temp);
  }
  for (i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
