#include <bits/stdc++.h>
const double eps = (1e-9);
using namespace std;
int dcmp(long double a, long double b) {
  return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(long long num, int idx) { return ((num >> idx) & 1ll) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(long long num, int idx) { return num ^ (1ll << idx); }
void M() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
const int N = 300009;
int arr[N], key[N], n, power[32], ans[N];
string ret;
struct trie {
  trie* child[3];
  int isleaf;
  trie() {
    isleaf = 0;
    memset(child, 0, sizeof(child));
  }
};
string to_bin(int n) {
  string ret = "", ans = "";
  while (n) {
    ret += (char)((n % 2) + '0');
    n /= 2;
  }
  int rem = 30 - ((int)(ret).size());
  while (rem--) {
    ret += '0';
  }
  for (int i = ((int)(ret).size()) - 1; i >= 0; i--) {
    ans += ret[i];
  }
  return ans;
}
int to_dec(string s) {
  int ans = 0;
  for (int i = ((int)(s).size()) - 1; i >= 0; i--) {
    ans += power[((int)(s).size()) - 1 - i] * (s[i] - '0');
  }
  return ans;
}
void insertt(trie* cur, int id, string s) {
  if (id == ((int)(s).size())) {
    cur->isleaf++;
    return;
  }
  int ch = s[id] - '0';
  if (cur->child[ch] == 0) {
    cur->child[ch] = new trie();
  }
  insertt(cur->child[ch], id + 1, s);
}
bool removee(trie* cur, int id, string s) {
  if (id == ((int)(s).size())) {
    cur->isleaf--;
    return (cur->isleaf == 0 && (cur->child[0] == 0 && cur->child[1] == 0));
  }
  int ch = s[id] - '0';
  bool ret = removee(cur->child[ch], id + 1, s);
  if (ret) {
    cur->child[ch] = 0;
    return (cur->isleaf == 0 && cur->child[0] == 0 && cur->child[1] == 0);
  }
  return 0;
}
void findd(trie* cur, int id, string s) {
  if (id == ((int)(s).size())) {
    return;
  }
  int ch = s[id] - '0';
  int opch = (s[id] == '0' ? '1' : '0') - '0';
  if (cur->child[ch] != 0) {
    ret += (char)(ch + '0');
    findd(cur->child[ch], id + 1, s);
  } else if (cur->child[opch] != 0) {
    ret += (char)(opch + '0');
    findd(cur->child[opch], id + 1, s);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  power[0] = 1;
  for (int i = 1; i <= 30; i++) power[i] = power[i - 1] * 2;
  trie* root = new trie();
  int no;
  for (int i = 0; i < n; i++) {
    cin >> no;
    string st = to_bin(no);
    insertt(root, 0, st);
  }
  for (int i = 0; i < n; i++) {
    string st = to_bin(arr[i]);
    ret = "";
    findd(root, 0, st);
    removee(root, 0, ret);
    ans[i] = arr[i] ^ (to_dec(ret));
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
}
