#include <bits/stdc++.h>
using namespace std;
void _print(long long t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(long double t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(unsigned long long t) { cerr << t; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(multiset<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
void init_code() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
struct node {
  node *next[2];
  long long cnt;
  node() {
    next[0] = next[1] = NULL;
    cnt = 0;
  }
};
struct bitTree {
  node *root;
  bitTree() { root = new node; }
  void insert(long long val) {
    root->cnt++;
    node *curr = root;
    for (long long i = 30; i >= 0; i--) {
      long long b = (val >> i) & 1;
      if (!curr->next[b]) curr->next[b] = new node;
      curr = curr->next[b];
      curr->cnt++;
    }
  }
  void erase(long long val) {
    root->cnt--;
    node *curr = root;
    for (long long i = 30; i >= 0; i--) {
      long long b = (val >> i) & 1;
      if (!curr->next[b]) curr->next[b] = new node;
      curr = curr->next[b];
      curr->cnt--;
    }
  }
  long long find(long long val) {
    node *curr = root;
    long long ans = 0;
    for (long long i = 30; i >= 0; i--) {
      long long b = (val >> i) & 1;
      if (!curr->next[b] || curr->next[b]->cnt <= 0) {
        curr = curr->next[1 - b];
        ans = ans | (1 << i);
      } else {
        curr = curr->next[b];
      }
    }
    return ans;
  }
};
signed main() {
  init_code();
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  bitTree T;
  for (long long i = 0; i < n; i++) {
    T.insert(b[i]);
  }
  for (long long i = 0; i < n; i++) {
    long long val = T.find(a[i]);
    T.erase(a[i] ^ val);
    cout << val << " ";
  }
}
