#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int sig[300003 * 20][2], cnt = 1;
int qt[300003 * 20][2];
int N;
int a[300003], b[300003];
void add(vector<int> &s) {
  int x = 0;
  for (int i = (int)0; i < (int)s.size(); i++) {
    int c = s[i];
    if (!sig[x][c]) {
      sig[x][c] = cnt++;
    }
    qt[x][c]++;
    x = sig[x][c];
  }
}
int vans[300003];
void sol(int x, int pos, int id, vector<int> &s, long long int val) {
  if (pos == s.size()) {
    vans[id] = val;
    return;
  }
  int c = s[pos];
  if (sig[x][c] && qt[x][c]) {
    qt[x][c]--;
    sol(sig[x][c], pos + 1, id, s, val * 2 + c);
  } else {
    c ^= 1;
    qt[x][c]--;
    sol(sig[x][c], pos + 1, id, s, val * 2 + c);
  }
}
int main() {
  scanf("%d", &N);
  for (int i = (int)0; i < (int)N; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = (int)0; i < (int)N; i++) {
    scanf("%d", &b[i]);
    vector<int> s;
    int aux = b[i];
    while (aux) {
      s.push_back(aux % 2);
      aux /= 2;
    }
    while (s.size() < 32) s.push_back(0);
    reverse(s.begin(), s.end());
    add(s);
  }
  for (int i = (int)0; i < (int)N; i++) {
    vector<int> s;
    int aux = a[i];
    while (aux) {
      s.push_back(aux % 2);
      aux /= 2;
    }
    while (s.size() < 32) s.push_back(0);
    reverse(s.begin(), s.end());
    sol(0, 0, i, s, 0);
  }
  for (int i = (int)0; i < (int)N; i++) {
    if (i) printf(" ");
    printf("%d", vans[i] ^ a[i]);
  }
  return 0;
}
