#include <bits/stdc++.h>
using namespace std;
struct govno {
  int cnt;
  govno* L;
  govno* R;
  govno() {}
  govno(int cnt) : cnt(cnt), L(NULL), R(NULL) {}
};
govno* root = new govno(0);
int q[30];
void get(int f) {
  for (int i = 0; i < 30; i++) {
    q[i] = f % 2;
    f /= 2;
  }
  govno* e = root;
  for (int i = 29; i >= 0; i--) {
    e->cnt++;
    if (q[i] == 1) {
      if (!e->R) {
        e->R = new govno(0);
      }
      e = e->R;
    } else {
      if (!e->L) {
        e->L = new govno(0);
      }
      e = e->L;
    }
  }
  e->cnt++;
  return;
}
int cnt(govno* e) {
  if (!e) {
    return 0;
  }
  return e->cnt;
}
int ans(int f) {
  for (int i = 0; i < 30; i++) {
    q[i] = f % 2;
    f /= 2;
  }
  govno* e = root;
  int ans = 0;
  for (int i = 29; i >= 0; i--) {
    e->cnt--;
    ans = ans * 2;
    if (q[i] == 1) {
      if (cnt(e->R) != 0) {
        e = e->R;
        ans += 1;
      } else {
        e = e->L;
      }
    } else {
      if (cnt(e->L) != 0) {
        e = e->L;
        ans;
      } else {
        e = e->R;
        ans += 1;
      }
    }
  }
  e->cnt--;
  return ans;
}
int a[300500];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int f;
    cin >> f;
    get(f);
  }
  for (int i = 0; i < n; i++) {
    cout << (a[i] ^ ans(a[i])) << " ";
  }
}
