#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& stream, const vector<T> v) {
  stream << "[ ";
  for (int i = 0; i < (int)v.size(); i++) stream << v[i] << " ";
  stream << "]";
  return stream;
}
long long fpow(long long x, long long p, long long m) {
  long long r = 1;
  for (; p; p >>= 1) {
    if (p & 1) r = r * x % m;
    x = x * x % m;
  }
  return r;
}
long long inv(long long a, long long b) {
  return a < 2 ? a : ((a - inv(b % a, a)) * b + 1) / a % b;
}
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
const int len = 30;
int N, a[300010], p[300010], t[9000010][2], T, cnt[9000010], root;
void insert(int& nod, int x, int p) {
  if (nod == 0) nod = ++T;
  cnt[nod]++;
  if (p == len) return;
  insert(t[nod][(x & (1 << (len - p - 1))) > 0], x, p + 1);
}
int getmin(int& nod, int x, int p) {
  cnt[nod]--;
  if (p == len) return 0;
  int b = (x & (1 << (len - p - 1))) > 0;
  if (cnt[t[nod][b]] > 0)
    return (b * (1 << (len - p - 1))) + getmin(t[nod][b], x, p + 1);
  else
    return (1 - b) * (1 << (len - p - 1)) + getmin(t[nod][!b], x, p + 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  int i;
  for (i = 1; i <= N; i++) cin >> a[i];
  for (i = 1; i <= N; i++) {
    cin >> p[i];
    insert(root, p[i], 0);
  }
  for (i = 1; i <= N; i++) cout << (a[i] ^ getmin(root, a[i], 0)) << " ";
  return 0;
}
