#include <bits/stdc++.h>
using namespace std;
typedef struct Node {
  int cnt;
  struct Node* left;
  struct Node* right;
} Node;
Node* newNode() {
  Node* node = (Node*)malloc(sizeof(Node));
  node->cnt = 0;
  node->left = NULL;
  node->right = NULL;
  return node;
}
Node* root;
void addNode(int x) {
  Node* troot = root;
  for (int i = 30; i >= 0; i--) {
    int bit = (x & (1 << i)) >> i;
    if (bit) {
      if (troot->right == NULL) {
        troot->right = newNode();
      }
      troot->right->cnt += 1;
      troot = troot->right;
    } else {
      if (troot->left == NULL) {
        troot->left = newNode();
      }
      troot->left->cnt += 1;
      troot = troot->left;
    }
  }
}
int getP(int a) {
  int p = 0;
  Node* ptr = root;
  for (int i = 30; i >= 0; i--) {
    int abit = (a & (1 << i)) >> i;
    if (abit == 1) {
      if (ptr->right != NULL && ptr->right->cnt != 0) {
        p |= (1 << i);
        ptr->right->cnt--;
        ptr = ptr->right;
      } else {
        ptr->left->cnt--;
        ptr = ptr->left;
      }
    }
    if (abit == 0) {
      if (ptr->left != NULL && ptr->left->cnt != 0) {
        ptr->left->cnt--;
        ptr = ptr->left;
      } else {
        p |= (1 << i);
        ptr->right->cnt--;
        ptr = ptr->right;
      }
    }
  }
  return p;
}
const int N = 4 * 100005;
int A[N];
int P[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  root = newNode();
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> P[i];
    addNode(P[i]);
  }
  for (int i = 0; i < n; i++) {
    int ans = (A[i] ^ (getP(A[i])));
    cout << ans << " ";
  }
  cout << (char)0x0A;
  return 0;
}
