#include <bits/stdc++.h>
using namespace std;
int arr[300005], key[300005];
struct node {
  int cnt;
  struct node *zero, *one;
  node() {
    cnt = 0;
    zero = NULL, one = NULL;
  }
} * root;
void Insert(int pat) {
  struct node *curr = root;
  int on = 1;
  for (int i = 30; i >= 0; i--) {
    int bit = (pat & (on << i));
    if (bit) {
      if (curr->one == NULL) curr->one = new node();
      curr = curr->one;
      curr->cnt++;
    } else {
      if (curr->zero == NULL) curr->zero = new node();
      curr = curr->zero;
      curr->cnt++;
    }
  }
}
void Search(int val) {
  struct node *curr = root;
  int on = 1;
  long long int ans = 0;
  for (int i = 30; i >= 0; i--) {
    int bit = (val & (on << i));
    if (bit) {
      if (curr->one != NULL && curr->one->cnt > 0) {
        curr = curr->one;
        curr->cnt--;
      } else if (curr->zero != NULL && curr->zero->cnt > 0) {
        curr = curr->zero;
        curr->cnt--;
        ans += (on << i);
      }
    } else {
      if (curr->zero != NULL && curr->zero->cnt > 0) {
        curr = curr->zero;
        curr->cnt--;
      } else if (curr->one != NULL && curr->one->cnt > 0) {
        curr = curr->one;
        curr->cnt--;
        ans += (on << i);
      }
    }
  }
  cout << ans << " ";
}
int main() {
  int n;
  cin >> n;
  root = new node();
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i <= n; i++) {
    cin >> key[i];
    Insert(key[i]);
  }
  for (int i = 1; i <= n; i++) {
    Search(arr[i]);
  }
  return 0;
}
