#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
class TrieNode {
 public:
  int endCnt = 0;
  int prefCnt = 0;
  TrieNode *left, *right;
  TrieNode() {
    prefCnt = 0;
    endCnt = 0;
    left = NULL;
    right = NULL;
  }
  void insert(long long num) {
    TrieNode* cur = this;
    for (int i = 30; i >= 0; --i) {
      if ((num & (1LL << i)) == 0) {
        if (!cur->left) {
          cur->left = new TrieNode();
        }
        cur->left->prefCnt++;
        cur = cur->left;
      } else {
        if (!cur->right) {
          cur->right = new TrieNode();
        }
        cur->right->prefCnt++;
        cur = cur->right;
      }
    }
    cur->endCnt++;
  }
  long long search(long long num) {
    TrieNode* cur = this;
    long long val = 0;
    for (int i = 30; i >= 0; --i) {
      if ((num & (1LL << i)) == 0) {
        if (cur->left && cur->left->prefCnt > 0) {
          cur->left->prefCnt--;
          cur = cur->left;
        } else {
          val |= (1LL << i);
          cur->right->prefCnt--;
          cur = cur->right;
        }
      } else {
        if (cur->right && cur->right->prefCnt > 0) {
          cur->right->prefCnt--;
          cur = cur->right;
        } else {
          val |= (1LL << i);
          cur->left->prefCnt--;
          cur = cur->left;
        }
      }
    }
    return val;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<long long> A(n);
  vector<long long> B(n);
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> B[i];
  }
  TrieNode* root = new TrieNode();
  for (long long i : B) {
    root->insert(i);
  }
  vector<long long> O(n);
  for (int i = 0; i < n; ++i) {
    O[i] = root->search(A[i]);
  }
  for (long long i : O) {
    cout << i << " ";
  }
  cout << "\n";
  return 0;
}
