#include <bits/stdc++.h>
int take() {
  int n;
  scanf("%d", &n);
  return n;
}
double ttake() {
  double n;
  scanf("%lf", &n);
  return n;
}
long long takes() {
  long long n;
  scanf("%lld", &n);
  return n;
}
int cas;
using namespace std;
bool approximatelyEqual(float a, float b, float epsilon) {
  return fabs(a - b) <= ((fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
bool essentiallyEqual(float a, float b, float epsilon) {
  return fabs(a - b) <= ((fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
bool definitelyGreaterThan(float a, float b, float epsilon) {
  return (a - b) > ((fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
bool definitelyLessThan(float a, float b, float epsilon) {
  return (b - a) > ((fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
struct info {
  int cnt;
  info* next[2];
  info() {
    cnt = 0;
    next[0] = next[1] = NULL;
  }
} * root;
string bit(int u) {
  string s = "";
  int ind = 31;
  while (ind--) {
    s += ((u % 2) + 48);
    u /= 2;
  }
  reverse(s.begin(), s.end());
  return s;
}
void ins(string s) {
  info* ptr = root;
  for (int i = 0; i <= s.size() - 1; i += 1) {
    int ind = s[i] - 48;
    if (ptr->next[ind] == NULL) {
      ptr->next[ind] = new info();
    }
    ptr = ptr->next[ind];
    ptr->cnt++;
  }
}
long long query(string s) {
  info* ptr = root;
  long long ans = 0;
  int len = s.size() - 1;
  for (int i = 0; i <= (int)(s.size() - 1); i += 1) {
    int ind = s[i] - 48;
    if (ptr->next[ind] == NULL || ptr->next[ind]->cnt == 0) ind ^= 1;
    if (ptr->next[ind] == NULL || ptr->next[ind]->cnt == 0) return ans;
    if (ind) ans += pow(2, len - i);
    ptr = ptr->next[ind];
  }
  return ans;
}
void del(info* ptr, string s) {
  for (int i = 0; i <= s.size() - 1; i += 1) {
    int ind = s[i] - 48;
    ptr = ptr->next[ind];
    ptr->cnt--;
  }
}
int main() {
  root = new info();
  int n = take(), arr[n + 1];
  for (int i = 1; i <= n; i += 1) {
    int u = take();
    arr[i] = u;
  }
  for (int i = 1; i <= n; i += 1) {
    int u = take();
    ins(bit(u));
  }
  for (int i = 1; i <= n; i += 1) {
    long long ans = query(bit(arr[i]));
    printf("%lld ", ans ^ arr[i]);
    del(root, bit(ans));
  }
  { return 0; };
}
