#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 9000012;
const int l = 30;
map<int, int> m1;
map<long long int, long long int> par;
long long int cnt = 2, kid[maxn][2], ans[maxn], a[maxn];
void add(int a) {
  int root = 1;
  for (int i = l - 1; i >= 0; i--) {
    bool ch = (a & (1 << i));
    if (kid[root][ch] == 0) {
      kid[root][ch] = cnt;
      par[cnt] = root;
      cnt++;
    }
    root = kid[root][ch];
  }
  m1[root] = a;
  ans[root]++;
}
int fnd(int a, int root = 1, int b = 0) {
  for (int i = l - 1; i >= 0; i--) {
    bool ch = (a & (1 << i));
    if (kid[root][ch] != 0) {
      root = kid[root][ch];
      b += (1 << i) * ch;
    } else {
      root = kid[root][!ch];
      b += (1 << i) * (!ch);
    }
  }
  ans[root]--;
  if (ans[root] == 0) {
    int dad = par[root];
    for (int i = 0; i < l; i++) {
      bool ch = (b & (1 << i));
      if (kid[dad][!ch] != 0) {
        kid[dad][ch] = 0;
        break;
      }
      kid[dad][ch] = 0;
      dad = par[dad];
    }
  }
  return m1[root];
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    add(x);
  }
  for (int i = 0; i < n; i++) {
    int x = fnd(a[i]);
    cout << (a[i] ^ x) << ' ';
  }
}
