#include <bits/stdc++.h>
using namespace std;
class DTrie {
  int N = 30;
  struct node {
    node* left = nullptr;
    node* right = nullptr;
    int cnt = 0;
  };
  void _add(node* cur, int a, int p) {
    cur->cnt++;
    if (p == -1) return;
    if (a & (1 << p)) {
      if (cur->right == nullptr) cur->right = new node();
      _add(cur->right, a, p - 1);
    } else {
      if (cur->left == nullptr) cur->left = new node();
      _add(cur->left, a, p - 1);
    }
  }
  int _get(node* cur, int a, int p) {
    cur->cnt--;
    if (p == -1) return 0;
    int result = 0;
    if (a & (1 << p)) {
      if (cur->right == nullptr || cur->right->cnt == 0)
        result = _get(cur->left, a, p - 1);
      else
        result = (1 << p) + _get(cur->right, a, p - 1);
    } else {
      if (cur->left == nullptr || cur->left->cnt == 0)
        result = (1 << p) + _get(cur->right, a, p - 1);
      else
        result = _get(cur->left, a, p - 1);
    }
    return result;
  }
  node* root = nullptr;

 public:
  DTrie() { root = new node(); }
  void add(int a) { _add(root, a, N); }
  int get(int a) { return _get(root, a, N); }
};
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> a(n), p(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  DTrie dt;
  for (int i = 0; i < n; i++) {
    dt.add(p[i]);
  }
  for (int i = 0; i < n; i++) {
    cout << (a[i] ^ dt.get(a[i])) << " ";
  }
}
