#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.push_back(x);
  return v;
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << ", ";
  err(++it, args...);
}
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const int M = 10000010;
const int ch = 2;
int trie[M][ch], top;
int cnt[M][ch];
int word[M];
void init() {
  memset(trie[0], 0, sizeof(trie[0])), memset(word, 0, sizeof(word)), top = 1;
  memset(cnt[0], 0, sizeof(cnt[0]));
}
void insert(string s, int v) {
  int rt = 0;
  int sz = s.size();
  for (int i = 0; i < sz; i++) {
    int idx = s[i] - '0';
    int nxt = trie[rt][idx];
    if (nxt == 0) {
      memset(trie[top], 0, sizeof(trie[top]));
      trie[rt][idx] = nxt = top++;
    }
    cnt[rt][idx]++;
    rt = nxt;
  }
  word[rt] = v;
}
int search(string s) {
  int rt = 0;
  int sz = s.size();
  for (int i = 0; i < sz; i++) {
    int idx = s[i] - '0';
    if (trie[rt][idx] == 0 || cnt[rt][idx] <= 0) {
      idx ^= 1;
    }
    cnt[rt][idx]--;
    rt = trie[rt][idx];
  }
  int ans = word[rt];
  return ans;
}
int n;
int a[300010], p[300010];
string i2s(int v) {
  string ret = "";
  for (int i = 29; i >= 0; i--) {
    if ((1 << i) & v)
      ret += '1';
    else
      ret += '0';
  }
  return ret;
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    init();
    for (int i = 1; i <= n; i++) {
      scanf("%d", &p[i]);
      string s = i2s(p[i]);
      insert(s, p[i]);
    }
    for (int i = 1; i <= n; i++) {
      string s = i2s(a[i]);
      int val = search(s);
      int ans = val ^ a[i];
      printf("%d%c", ans, i == n ? '\n' : ' ');
    }
  }
  return 0;
}
