#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = 3.141592653589793238462;
const int dr[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dc[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int a[300005], p[300005], ans[300005];
struct node {
  int key, num;
  node* children[2];
};
node* makeNode() {
  node* now = new node;
  now->key = 0, now->num = 0;
  now->children[0] = now->children[1] = NULL;
  return now;
}
void insert(node* root, int num, int ind) {
  root->num++;
  if (ind < 0) {
    root->key = num;
    return;
  }
  bool bit = (num & (1 << ind));
  if (root->children[bit] == NULL) {
    root->children[bit] = makeNode();
  }
  insert(root->children[bit], num, ind - 1);
}
void removeTrie(node* root, int num, int ind) {
  root->num--;
  if (ind < 0) return;
  bool bit = (num & (1 << ind));
  removeTrie(root->children[bit], num, ind - 1);
  root->num = 0;
  for (int i = 0; i < 2; i++) {
    if (root->children[i] != NULL) {
      root->num += root->children[i]->num;
      if (root->children[i]->num == 0) {
        root->children[i] = NULL;
      }
    }
  }
  if (root->num == 0) root = NULL;
}
pair<int, int> minQuery(node* root, int num) {
  node* temp = root;
  for (int i = 29; i >= 0; i--) {
    bool bit = (num & (1 << i));
    if (temp->children[bit] != NULL && temp->children[bit]->num > 0) {
      temp = temp->children[bit];
    } else {
      temp = temp->children[1 - bit];
    }
  }
  return {temp->key ^ num, temp->key};
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  node* root = makeNode();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    insert(root, p[i], 29);
  }
  for (int i = 0; i < n; i++) {
    auto pi = minQuery(root, a[i]);
    ans[i] = pi.first;
    removeTrie(root, pi.second, 29);
    cout << ans[i] << ' ';
  }
  cout << '\n';
  return 0;
}
