#include <bits/stdc++.h>
using namespace std;
const long double E = 2.71828182845904523536;
const long double pi = acos(-1);
const double eps = 1e-9;
const long long mod = 1e9 + 7;
const long long inf = 1LL << 30;
const int N = 300300;
int a[N];
string Tobin(int x) {
  string res = "";
  while (x) {
    if (x & 1)
      res += '1';
    else
      res += '0';
    x /= 2;
  }
  while (res.length() < 30) res += '0';
  reverse(res.begin(), res.end());
  return res;
}
struct Node {
  Node* children[5];
  int cntWords;
  int cntPrefs;
  Node() {
    memset(children, NULL, sizeof children);
    cntWords = 0;
    cntPrefs = 0;
  }
};
Node* root;
void add(const string& s) {
  Node* cur = root;
  for (char c : s) {
    int x = c - '0';
    cur->cntPrefs++;
    if (!cur->children[x]) {
      cur->children[x] = new Node();
    }
    cur = cur->children[x];
  }
  cur->cntPrefs++;
  cur->cntWords++;
}
int find(const string& s) {
  int ans = 0;
  int l = s.length();
  Node* cur = root;
  for (int i = 0; i < s.length(); i++) {
    int x = s[i] - '0';
    if (cur->children[x] && cur->children[x]->cntPrefs) {
      cur = cur->children[x];
      ans += (x) * (1 << (l - i - 1));
    } else {
      cur = cur->children[!x];
      ans += (!x) * (1 << (l - i - 1));
    }
  }
  return ans;
}
void del(const string& s) {
  Node* cur = root;
  for (char c : s) {
    int x = c - '0';
    cur->cntPrefs--;
    if (!cur->cntPrefs) {
      delete cur;
      return;
    }
    cur = cur->children[x];
  }
  cur->cntPrefs--;
  cur->cntWords--;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  root = new Node();
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    add(Tobin(x));
  }
  for (int i = 0; i < n; i++) {
    int x = find(Tobin(a[i]));
    del(Tobin(x));
    printf("%d ", (x ^ a[i]));
  }
}
