#include <bits/stdc++.h>
using namespace std;
struct item {
  int first, second, cnt, val;
  item() { cnt = val = 0; }
  item(int first, int second) : first(first), second(second) { cnt = val = 0; }
};
vector<item> b;
void add(int n) {
  int v = 0;
  b[0].cnt++;
  for (int i = 30; i >= 0; i--) {
    int c = bool((n & (1 << i)));
    if (c) {
      if (!b[v].second) {
        b[v].second = b.size();
        b.emplace_back(0, 0);
      }
      v = b[v].second;
    } else {
      if (!b[v].first) {
        b[v].first = b.size();
        b.emplace_back(0, 0);
      }
      v = b[v].first;
    }
    b[v].cnt++;
  }
  b[v].val = n;
}
int closest(int n, int v, int bit) {
  if (bit == -1) {
    b[v].cnt--;
    return b[v].val;
  }
  int c = bool(n & (1 << bit));
  int ret;
  if (c) {
    if (b[v].second)
      ret = closest(n, b[v].second, bit - 1);
    else
      ret = closest(n, b[v].first, bit - 1);
  } else {
    if (b[v].first)
      ret = closest(n, b[v].first, bit - 1);
    else
      ret = closest(n, b[v].second, bit - 1);
  }
  if (b[v].first && b[b[v].first].cnt == 0) b[v].first = 0;
  if (b[v].second && b[b[v].second].cnt == 0) b[v].second = 0;
  b[v].cnt--;
  return ret;
}
int main() {
  int n;
  cin >> n;
  b.emplace_back(0, 0);
  vector<int> a(n), p(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    add(p[i]);
  }
  for (int i = 0; i < n; i++) {
    int ret = closest(a[i], 0, 30);
    cout << (ret ^ a[i]) << ' ';
  }
  return 0;
}
