#include <bits/stdc++.h>
using namespace std;
vector<int> A, P;
int ans;
struct node {
  struct node *a[2];
  int cnt;
};
struct node *get_n() {
  struct node *tmp = new node;
  for (int i = 0; i < 2; i++) tmp->a[i] = NULL;
  tmp->cnt = 0;
  return tmp;
}
void inser(struct node *root, string s) {
  struct node *tmp = root;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    int pos = s[i] - '0';
    if (tmp->a[pos] == NULL) tmp->a[pos] = get_n();
    tmp = tmp->a[pos];
  }
  tmp->cnt++;
  return;
}
struct node *delet(struct node *root, string &s, int pos) {
  if (pos == 30) {
    root->cnt--;
    if (root->cnt == 0) root = NULL;
    return root;
  }
  struct node *tmp;
  if (s[pos] == '0') {
    if (root->a[0] != NULL) {
      tmp = delet(root->a[0], s, pos + 1);
      if (tmp == NULL) {
        root->a[0] = NULL;
        if (root->a[1] == NULL) root = NULL;
      }
    } else {
      ans += (1 << (29 - pos));
      tmp = delet(root->a[1], s, pos + 1);
      if (tmp == NULL) {
        root->a[1] = NULL;
        if (root->a[0] == NULL) root = NULL;
      }
    }
  } else {
    if (root->a[1] != NULL) {
      tmp = delet(root->a[1], s, pos + 1);
      if (tmp == NULL) {
        root->a[1] = NULL;
        if (root->a[0] == NULL) root = NULL;
      }
    } else {
      ans += (1 << (29 - pos));
      tmp = delet(root->a[0], s, pos + 1);
      if (tmp == NULL) {
        root->a[0] = NULL;
        if (root->a[1] == NULL) root = NULL;
      }
    }
  }
  return root;
}
signed main() {
  struct node *root = get_n();
  int n;
  scanf("%d", &n);
  A.resize(n);
  P.resize(n);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
  for (int i = 0; i < n; i++) {
    scanf("%d", &P[i]);
    string s;
    int x = P[i];
    while (x > 0) {
      if (x % 2 == 1)
        s = s + "1";
      else
        s = s + "0";
      x /= 2;
    }
    while (s.size() < 30) s = s + "0";
    reverse(s.begin(), s.end());
    inser(root, s);
  }
  for (int i = 0; i < n; i++) {
    string s;
    int x = A[i];
    while (x > 0) {
      if (x % 2 == 1)
        s = s + "1";
      else
        s = s + "0";
      x /= 2;
    }
    while (s.size() < 30) s = s + "0";
    reverse(s.begin(), s.end());
    ans = 0;
    root = delet(root, s, 0);
    printf("%d ", ans);
  }
  return 0;
}
