#include <bits/stdc++.h>
using namespace std;
struct trie {
  int have[2], child[2];
} a[5000005];
int b[300005], c[300005], cnt = 0, ans;
void update(int p, int bit, int res, int val) {
  int x = (res >> bit) % 2;
  if (a[p].child[x] == 0) a[p].child[x] = ++cnt;
  a[p].have[x] += val;
  if (bit == 0) return;
  update(a[p].child[x], bit - 1, res, val);
}
int get(int res) {
  int p = 0, ans1 = res;
  for (int bit = 30; bit >= 0; bit--) {
    int x = (res >> bit) % 2;
    if (x == 0) {
      if (a[p].have[0] > 0) {
        p = a[p].child[0];
      } else if (a[p].have[1] > 0) {
        ans1 = ans1 ^ (1 << bit);
        ans = ans ^ (1 << bit);
        p = a[p].child[1];
      }
    } else {
      if (a[p].have[1] > 0) {
        ans1 = ans1 ^ (1 << bit);
        ans = ans ^ (1 << bit);
        p = a[p].child[1];
      } else if (a[p].have[0] > 0) {
        p = a[p].child[0];
      }
    }
  }
  return ans1;
}
int main() {
  int n;
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    update(0, 30, c[i], 1);
  }
  for (int i = 0; i < n; i++) {
    ans = 0;
    cout << get(b[i]) << " ";
    update(0, 30, ans, -1);
  }
}
