#include <bits/stdc++.h>
using namespace std;
int ch[2][300005 * 31], sz[300005 * 31], tot = 1;
int n;
int a[300005];
void add(int x) {
  int now = 1;
  sz[1]++;
  for (int i = 30; ~i; i--) {
    int f = ((x >> i) & 1);
    if (!ch[f][now]) ch[f][now] = ++tot;
    now = ch[f][now];
    sz[now]++;
  }
}
int get(int x) {
  int now = 1, v = 0;
  for (int i = 30; ~i; i--) {
    int f = ((x >> i) & 1);
    if (ch[f][now] && sz[ch[f][now]]) {
      now = ch[f][now];
      sz[now]--;
    } else {
      v += (1 << i);
      now = ch[f ^ 1][now];
      sz[now]--;
    }
  }
  return v;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1, x; i <= n; ++i) {
    cin >> x;
    add(x);
  }
  for (int i = 1; i <= n; ++i) cout << get(a[i]) << " ";
  return 0;
}
