#include <bits/stdc++.h>
using namespace std;
typedef struct Node {
  int nExp;
  int nCount;
  Node *left, *right;
  Node(int e) {
    nExp = e;
    nCount = 0;
    left = right = nullptr;
  }
} NODE, *PNODE;
uint32_t A[300005], O[300005], P[300005];
void fnAdd(PNODE pNode, int nKey) {
  pNode->nCount++;
  if (pNode->nExp < 0) {
    return;
  }
  uint32_t nVal = (1 << pNode->nExp);
  bool bOne = ((nKey & nVal) != 0);
  if (bOne) {
    if (pNode->right == nullptr) {
      pNode->right = new NODE(pNode->nExp - 1);
    }
    fnAdd(pNode->right, nKey);
  } else {
    if (pNode->left == nullptr) {
      pNode->left = new NODE(pNode->nExp - 1);
    }
    fnAdd(pNode->left, nKey);
  }
}
void fnDelete(PNODE pNode, int nKey) {
  if (pNode == nullptr) {
    return;
  }
  pNode->nCount--;
  if (pNode->nExp < 0) {
    return;
  }
  uint32_t nVal = (1 << pNode->nExp);
  bool bOne = ((nKey & nVal) != 0);
  if (bOne) {
    fnDelete(pNode->right, nKey);
  } else {
    fnDelete(pNode->left, nKey);
  }
  if (pNode->nCount <= 0) {
    if (pNode->left) {
      delete pNode->left;
    }
    if (pNode->right) {
      delete pNode->right;
    }
    pNode->left = nullptr;
    pNode->right = nullptr;
  }
}
int fnGetKey(PNODE pNode, int nA) {
  if ((pNode->nExp < 0) || (pNode->nCount <= 0)) {
    return 0;
  }
  int nKey = 0, nVal = (1 << (pNode->nExp));
  bool bBitofAonE = ((nA & nVal) != 0);
  if (pNode->left == nullptr) {
    nKey = nVal + fnGetKey(pNode->right, nA);
    return nKey;
  }
  if (pNode->right == nullptr) {
    nKey = fnGetKey(pNode->left, nA);
    return nKey;
  }
  PNODE pLeft = pNode->left, pRight = pNode->right;
  if (pLeft->nCount <= 0) {
    nKey = nVal + fnGetKey(pRight, nA);
    return nKey;
  }
  if (pRight->nCount <= 0) {
    nKey = fnGetKey(pLeft, nA);
    return nKey;
  }
  if (bBitofAonE) {
    nKey = nVal + fnGetKey(pRight, nA);
    return nKey;
  } else {
    nKey = fnGetKey(pLeft, nA);
    return nKey;
  }
  return 0;
}
int main(void) {
  string s;
  char sz[64];
  int N, nKey;
  NODE root(30);
  PNODE pRoot = &root;
  memset(O, 0, sizeof(O));
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> P[i];
  }
  for (int i = 0; i < N; i++) {
    fnAdd(pRoot, P[i]);
  }
  for (int i = 0; i < N; i++) {
    nKey = fnGetKey(pRoot, A[i]);
    O[i] = nKey ^ A[i];
    fnDelete(pRoot, nKey);
    sprintf(sz, "%d ", O[i]);
    s += sz;
  }
  cout << s << endl;
  return 0;
}
