#include <bits/stdc++.h>
using namespace std;
const int N = 300009;
unsigned long long a[N];
int k[N];
struct node {
  node *lo = nullptr, *hi = nullptr;
  unsigned long long number = 0;
  int cnt = 0;
};
node *insert(node *v, unsigned long long mask, unsigned long long val) {
  if (v == nullptr) {
    v = new node();
  }
  if (mask == 0) {
    v->number = val;
    v->cnt++;
    return v;
  }
  if ((mask & val) == 0) {
    v->lo = insert(v->lo, mask >> 1, val);
  } else {
    v->hi = insert(v->hi, mask >> 1, val);
  }
  return v;
}
unsigned long long getBest(node *v, unsigned long long mask,
                           unsigned long long val) {
  if (mask == 0) {
    return v->number;
  }
  if ((mask & val) == 0 && v->lo != nullptr || v->hi == nullptr) {
    return getBest(v->lo, mask >> 1, val);
  } else {
    return getBest(v->hi, mask >> 1, val);
  }
}
node *rremove(node *v, unsigned long long mask, unsigned long long val) {
  if (mask == 0) {
    v->cnt--;
    if (v->cnt == 0) return nullptr;
    return v;
  }
  if ((val & mask) == 0) {
    v->lo = rremove(v->lo, mask >> 1, val);
  } else {
    v->hi = rremove(v->hi, mask >> 1, val);
  }
  if (v->hi == nullptr && v->lo == nullptr) return nullptr;
  return v;
}
void solve() {
  int n;
  cin >> n;
  node *root = new node();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    unsigned long long p;
    cin >> p;
    insert(root, (1ull << (35)), p);
  }
  for (int i = 0; i < n; i++) {
    unsigned long long bestF = getBest(root, (1ull << (35)), a[i]);
    cout << (a[i] ^ bestF) << " ";
    rremove(root, (1ull << (35)), bestF);
  }
}
int main() {
  cout.precision(17);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  getchar();
  getchar();
}
