#include <bits/stdc++.h>
using namespace std;
const int mn = 4e5 + 100;
const int inf = 1e9;
const int mod = 1e9 + 7;
int n, a[mn], p;
int adj[mn * 40][2], cnt = 1, sz[mn * 40];
void add(int x) {
  int po = 0;
  for (int i = 29; i >= 0; i--) {
    int r = (x >> i) & 1;
    if (adj[po][r] == 0) {
      adj[po][r] = cnt++;
    }
    sz[po]++;
    po = adj[po][r];
  }
  sz[po]++;
  return;
}
int find(int x) {
  int po = 0, ans = 0, db = 0;
  for (int i = 29; i >= 0; i--) {
    sz[po]--;
    int r = (x >> i) & 1;
    if (adj[po][r] != 0 && sz[adj[po][r]]) {
      po = adj[po][r];
      db |= (r << i);
    } else {
      po = adj[po][1 - r];
      ans |= (1 << i);
      db |= ((1 - r) << i);
    }
  }
  sz[po]--;
  return ans;
}
int main() {
  cout << setprecision(30);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> p;
    add(p);
  }
  for (int i = 0; i < n; i++) {
    int b = find(a[i]);
    cout << b << " ";
  }
  cout << "\n";
  return 0;
}
