#include <bits/stdc++.h>
using namespace std;
int A[300005];
int P[300005];
struct data {
  bool endmark;
  data* next[5];
  int tot[5];
  data() {
    for (int i = 0; i < 2; i++) {
      next[i] = NULL;
      tot[i] = 0;
    }
    endmark = false;
  }
} * root;
void INSERT(int val) {
  data* now = root;
  for (int i = 30; i >= 0; i--) {
    int bt = (bool)(val & (1 << i));
    if (now->next[bt] == NULL) {
      now->next[bt] = new data();
    }
    now->tot[bt]++;
    now = now->next[bt];
  }
  now->endmark = true;
}
int SEARCH(int val) {
  data* now = root;
  int tot = 0;
  for (int i = 30; i >= 0; i--) {
    int bt = (val & (1 << i));
    if (bt == 0) {
      if (now->next[0] != NULL && now->tot[0] > 0) {
        now->tot[0]--;
        now = now->next[0];
      } else {
        tot = tot | (1 << i);
        now = now->next[1];
      }
    } else {
      if (now->next[1] != NULL && now->tot[1] > 0) {
        now->tot[1]--;
        now = now->next[1];
      } else {
        tot = tot | (1 << i);
        now = now->next[0];
      }
    }
  }
  return tot;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", A + i);
  }
  root = new data();
  for (int i = 1; i <= n; i++) {
    scanf("%d", P + i);
    INSERT(P[i]);
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", SEARCH(A[i]));
  }
}
