#include <bits/stdc++.h>
using namespace std;
struct data {
  int x[2] = {-1, -1};
  int kol = 0;
  data() {
    x[0] = -1;
    x[1] = -1;
  }
};
const int maxn = 300000;
data b[maxn * 30 + 1];
int f = 1;
void add(int n, int i, int q = 1 << 30) {
  b[i].kol++;
  if (q == 0) {
    return;
  }
  if (b[i].x[n / q] == -1) {
    b[i].x[n / q] = f;
    f++;
  }
  add(n % q, b[i].x[n / q], q >> 1);
}
int ans = 0;
bool find(int n, int i, int q = 1 << 30) {
  if (q != 0) {
    if (b[i].x[n / q] == -1) {
      ans += q;
      if (find(n % q, b[i].x[(n / q + 1) % 2], q >> 1)) {
        b[i].x[(n / q + 1) % 2] = -1;
      }
    } else {
      if (find(n % q, b[i].x[n / q], q >> 1)) {
        b[i].x[n / q] = -1;
      }
    }
  }
  b[i].kol--;
  if (b[i].kol == 0) {
    return true;
  } else {
    return false;
  }
}
int main() {
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int n, a;
  cin >> n;
  queue<int> q;
  for (int i = 0; i < n; i++) {
    cin >> a;
    q.push(a);
  }
  for (int i = 0; i < n; i++) {
    cin >> a;
    add(a, 0);
  }
  for (int i = 0; i < n; i++) {
    a = q.front();
    q.pop();
    ans = 0;
    find(a, 0);
    cout << ans << ' ';
  }
  return 0;
}
