#include <bits/stdc++.h>
using namespace std;
void read(long long int n = 10) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(n) << fixed;
}
long long int M = 1e9 + 7;
long long int M1 = 998244353;
typedef struct trie {
  typedef struct node {
    node* nxt[2];
    long long int cnt = 0;
    node() {
      nxt[0] = nxt[1] = NULL;
      cnt = 0;
    }
  } Node;
  Node* head;
  trie() { head = new Node(); }
  void insert(long long int x) {
    Node* cur = head;
    for (long long int i = 32; i >= 0; i--) {
      long long int b = (x >> i) & 1;
      if (!cur->nxt[b]) cur->nxt[b] = new Node();
      cur = cur->nxt[b];
      cur->cnt++;
    }
  }
  void remove(long long int x) {
    Node* cur = head;
    for (long long int i = 32; i >= 0; i--) {
      long long int b = (x >> i) & 1;
      cur = cur->nxt[b];
      cur->cnt--;
    }
  }
  long long int find(long long int x) {
    Node* cur = head;
    long long int ans = 0;
    for (long long int i = 32; i >= 0; i--) {
      long long int b = (x >> i) & 1;
      if (cur->nxt[b] && cur->nxt[b]->cnt > 0) {
        cur = cur->nxt[b];
      } else {
        ans += (1LL << i);
        cur = cur->nxt[!b];
      }
      cur->cnt--;
    }
    return ans;
  }
} Trie;
int32_t main() {
  read();
  Trie head;
  long long int n;
  cin >> n;
  vector<long long int> arr(n), brr(n);
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  for (long long int i = 0; i < n; i++) {
    cin >> brr[i];
    head.insert(brr[i]);
  }
  for (long long int i = 0; i < n; i++) {
    cout << head.find(arr[i]) << " ";
  }
}
