#include <bits/stdc++.h>
using namespace std;
using ui32 = unsigned;
using ui64 = unsigned long long;
using i64 = long long;
using i32 = int;
static constexpr bool debug = false;
struct node {
  node *c[2] = {0, 0};
  int cnt = 0;
};
node *root = new node;
void insert_rec(node *nd, ui32 number, int i) {
  ++nd->cnt;
  if (i != -1) {
    int bit = (number >> i) & 1;
    if (nd->c[bit] == nullptr) nd->c[bit] = new node;
    insert_rec(nd->c[bit], number, i - 1);
  }
}
void insert(ui32 number) { insert_rec(root, number, 31); }
bool remove_rec(node *nd, ui32 number, int i) {
  if (i != -1) {
    int bit = (number >> i) & 1;
    if (remove_rec(nd->c[bit], number, i - 1)) nd->c[bit] = nullptr;
  }
  if (--nd->cnt == 0) {
    delete nd;
    return true;
  } else {
    return false;
  }
}
void remove(ui32 number) { remove_rec(root, number, 31); }
void print_numbers_rec(node *nd, ui32 number, int i) {
  if (nd == nullptr) return;
  if (i == -1) {
    for (int j = 0; j < nd->cnt; ++j) {
      cerr << number << ' ';
    }
  }
  print_numbers_rec(nd->c[0], number << 1, i - 1);
  print_numbers_rec(nd->c[1], (number << 1) | 1, i - 1);
}
void print_numbers() {
  print_numbers_rec(root, 0, 31);
  cerr << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<ui32> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    ui32 t;
    cin >> t;
    insert(t);
  }
  vector<int> o(n);
  for (int i = 0; i < n; ++i) {
    node *cur = root;
    ui32 xored = 0;
    for (int j = 31; j >= 0; --j) {
      int bit = (a[i] >> j) & 1;
      if (cur->c[bit] != nullptr) {
        cur = cur->c[bit];
        xored = (xored << 1) | bit;
      } else {
        cur = cur->c[bit ^ 1];
        xored = (xored << 1) | (bit ^ 1);
      }
    }
    o[i] = a[i] ^ xored;
    remove(xored);
  }
  for (int i = 0; i < n; ++i) {
    cout << o[i] << " \n"[i + 1 == n];
  }
}
