#include <bits/stdc++.h>
using namespace std;
const long long k = 2;
struct node {
  vector<node*> to;
  node() { to.resize(k, 0); }
  long long cnt = 0;
};
node* root = new node();
inline bool getbit(long long a, long long pos) { return a & (1 << pos); }
void addstring(long long b) {
  vector<long long> a;
  for (long long i = 0; i < 30; ++i) {
    a.push_back(getbit(b, i));
  }
  reverse(a.begin(), a.end());
  node* cur = root;
  for (long long i = 0; i < a.size(); ++i) {
    long long c = a[i];
    if (cur->to[c] == 0) {
      cur->to[c] = new node();
    }
    cur = cur->to[c];
    cur->cnt++;
  }
}
long long get(long long b) {
  vector<long long> a;
  long long ans = 0;
  for (long long i = 0; i < 30; ++i) {
    a.push_back(getbit(b, i));
  }
  reverse(a.begin(), a.end());
  node* cur = root;
  for (long long i = 0; i < a.size(); ++i) {
    long long bet = a[i];
    if (cur->to[bet] && cur->to[bet]->cnt > 0) {
      cur = cur->to[bet];
      ans += bet * (1 << (29 - i));
      cur->cnt--;
    } else {
      cur = cur->to[1 - bet];
      ans += (1 - bet) * (1 << (29 - i));
      cur->cnt--;
    }
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> b(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; ++i) {
    cin >> b[i];
    addstring(b[i]);
  }
  for (long long i = 0; i < n; ++i) {
    cout << (get(a[i]) ^ a[i]) << " ";
  }
}
