#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const int N = 3e5 + 5;
long long int a[N], p[N];
struct node {
  int cnt;
  node* next[2];
  node() {
    cnt = 0;
    next[0] = NULL;
    next[1] = NULL;
  }
};
void make(long long int num, node* temp) {
  for (long long int i = 30; i >= 0; --i) {
    long long int c = ((num >> i) & 1LL);
    if (temp->next[c] == NULL) {
      temp->next[c] = new node;
    }
    temp = temp->next[c];
    ++temp->cnt;
  }
}
long long int result(long long int num, node* temp) {
  long long int ans = 0;
  for (long long int i = 30; i >= 0; --i) {
    long long int c = ((num >> i) & 1LL);
    if (temp->next[c] != NULL && temp->next[c]->cnt) {
      temp = temp->next[c];
      --temp->cnt;
    } else {
      temp = temp->next[!c];
      ans += (1 << i);
      --temp->cnt;
    }
  }
  return ans;
}
int main() {
  node* head = new node;
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; ++i) {
    cin >> p[i];
    make(p[i], head);
  }
  for (long long int i = 0; i < n; ++i) {
    long long int ans = result(a[i], head);
    cout << ans << " ";
  }
}
