#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long fastexp(long long x, long long a) {
  long long res = 1;
  while (a > 0) {
    if (a & 1) {
      res = (res * x) % mod;
    }
    a = a >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long inverse(long long n) { return fastexp(n, mod - 2); }
typedef struct data {
  int cnt = 0;
  data* bit[2];
} trie;
trie* head;
void insert(int x) {
  trie* cur = head;
  for (int i = 30 - 1; i >= 0; --i) {
    int b = (x >> i) & 1;
    if (!cur->bit[b]) {
      cur->bit[b] = new trie();
    }
    cur = cur->bit[b];
    cur->cnt++;
  }
}
void remove(int x) {
  trie* cur = head;
  for (int i = 30 - 1; i >= 0; --i) {
    int b = (x >> i) & 1;
    cur = cur->bit[b];
    cur->cnt--;
  }
}
int minxor(int x) {
  trie* cur = head;
  int ans = 0;
  int res = 0;
  for (int i = 30 - 1; i >= 0; --i) {
    int b = (x >> i) & 1;
    int n = b ^ 1;
    if (cur->bit[b] && cur->bit[b]->cnt > 0) {
      cur = cur->bit[b];
      if (b) {
        res += (1 << i);
      }
    } else {
      ans += (1 << i);
      cur = cur->bit[n];
      if (n) {
        res += (1 << i);
      }
    }
  }
  remove(res);
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  head = new trie();
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
    insert(b[i]);
  }
  for (int i = 0; i < n; ++i) {
    cout << minxor(a[i]) << " ";
  }
  return 0;
}
