#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
struct node {
  int present;
  node* left;
  node* right;
  node() {
    left = NULL;
    right = NULL;
    present = 0;
  }
};
node root;
void init() {
  root.present = 0;
  root.left = NULL;
  root.right = NULL;
}
void insert(node* curr, int n, int level) {
  if (level == -1) return;
  int x = ((n >> level) & 1);
  if (x) {
    if (curr->right == NULL) {
      curr->right = new node;
    }
    curr->right->present++;
    insert(curr->right, n, level - 1);
  } else {
    if (curr->left == NULL) curr->left = new node;
    curr->left->present++;
    insert(curr->left, n, level - 1);
  }
}
void query(node* curr, int n, int level, int& ans) {
  if (level == -1 || curr == NULL) return;
  int x = ((n >> level) & 1);
  if (x) {
    if (curr->right != NULL && curr->right->present > 0) {
      curr->right->present--;
      query(curr->right, n, level - 1, ans);
    } else {
      ans += (1 << level);
      curr->left->present--;
      query(curr->left, n, level - 1, ans);
    }
  } else {
    if (curr->left != NULL && curr->left->present > 0) {
      curr->left->present--;
      query(curr->left, n, level - 1, ans);
    } else {
      ans += (1 << level);
      curr->right->present--;
      query(curr->right, n, level - 1, ans);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  init();
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    insert(&root, x, 31);
  }
  for (int i = 0; i < n; i++) {
    int val = 0;
    query(&root, arr[i], 31, val);
    cout << val << " ";
  }
  return 0;
}
