#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128000000")
using namespace std;
const int inf = (int)1e9 + 10;
const long long infLL = 10000000000000000LL;
const int mod = (int)1e9 + 7;
const double eps = 1e-11;
const double pi = 3.141592653589793;
const int maxLen = (int)9e6 + 10;
const int base = 31;
const int dd = (int)3e5 + 10;
map<int, int> to[maxLen];
int fin[maxLen];
int cnt[maxLen];
int A[dd];
int P[dd];
int sz = 1;
void add(const string &s, int q) {
  int v = 0;
  for (int i = 0; i < s.length(); i++) {
    char c = s[i];
    if (!to[v].count(c)) to[v][c] = sz++;
    cnt[v]++;
    v = to[v][c];
  }
  cnt[v]++;
  fin[v] = q;
}
int get(const string &s, int v, int i) {
  cnt[v]--;
  if (fin[v] > -1) return fin[v];
  char c = s[i];
  if (to[v].count(c) && cnt[to[v][c]] > 0) {
    int x = get(s, to[v][c], i + 1);
    return x;
  }
  char d = '0' + ((c - '0') ^ 1);
  if (to[v].count(d) && cnt[to[v][d]] > 0) {
    int x = get(s, to[v][d], i + 1);
    return x;
  }
}
string toStr(int x) {
  int K = 30;
  string s(K, '0');
  for (int i = 0; i < K; i++) s[i] = ((x >> i) & 1) + '0';
  reverse((s).begin(), (s).end());
  return s;
}
int main() {
  memset(fin, -1, sizeof(fin));
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
  for (int i = 0; i < n; i++) scanf("%d", &P[i]);
  for (int i = 0; i < n; i++) {
    string s = toStr(P[i]);
    add(s, i);
  }
  for (int i = 0; i < n; i++) {
    string s = toStr(A[i]);
    int x = get(s, 0, 0);
    A[i] ^= P[x];
  }
  for (int i = 0; i < n; i++) printf("%d ", A[i]);
  return 0;
}
