#include <bits/stdc++.h>
using namespace std;
bool vowel(char a) {
  a = toupper(a);
  if ((a == 'A') || (a == 'E') || (a == 'I') || (a == 'O') || (a == 'U'))
    return 1;
  return 0;
}
long long int n, m, q, a, b, c, sum = 0, cnt = 0;
long long int arr[300005];
map<long long int, bool> mp;
string s;
int setBit(long long int N, int pos) {
  return N = N | ((long long int)1 << pos);
}
int clearBit(long long int N, int pos) {
  return N = N & ~((long long int)1 << pos);
}
struct node {
  bool endmark;
  node* left;
  node* right;
  int cnt;
  node() {
    left = NULL;
    right = NULL;
    endmark = false;
    cnt = 0;
  }
} * root;
void insert_it(long long int x) {
  node* curr = root;
  curr->cnt++;
  for (int i = 29; i >= 0; i--) {
    int it = (x >> i) & 1;
    if (it) {
      if (curr->right == NULL) {
        curr->right = new node();
      }
      curr = curr->right;
    } else {
      if (curr->left == NULL) curr->left = new node();
      curr = curr->left;
    }
    curr->cnt++;
  }
}
long long int min_of(long long int x) {
  node* curr = root;
  curr->cnt--;
  for (int i = 29; i >= 0; i--) {
    int it = (x >> i) & 1;
    bool ok = 0;
    if (!it) {
      if (curr->left != NULL) {
        if (curr->left->cnt > 0) {
          ok = 1;
          curr = curr->left;
        }
      }
      if (!ok) {
        x = setBit(x, i);
        curr = curr->right;
      }
    }
    if (it) {
      if (curr->right != NULL) {
        if (curr->right->cnt > 0) {
          x = clearBit(x, i);
          ok = 1;
          curr = curr->right;
        }
      }
      if (!ok) {
        curr = curr->left;
      }
    }
    curr->cnt--;
  }
  return x;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  char ch;
  long long int a;
  root = new node();
  int p = 1;
  for (int i = 0; i < n; i++) {
    cin >> a;
    { insert_it(a); }
  }
  for (int i = 0; i < n; i++) {
    a = arr[i];
    cout << min_of(a) << " ";
  }
}
