#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return (a > b ? a = b, true : false);
}
template <class T>
bool uax(T &a, T b) {
  return (a < b ? a = b, true : false);
}
int const B = 30;
int const MAXN = 3e5 + 41;
int n, a[MAXN], b[MAXN];
int ans[MAXN];
int p2[B];
bool bit(int m, int i) { return (m & (1 << i)); }
struct Node {
  Node *one, *zero;
  int q;
  Node() {
    one = zero = NULL;
    q = 0;
  };
  void push(int m, int b = B - 1) {
    q++;
    if (b == -1) {
      return;
    }
    if (bit(m, b)) {
      if (!one) {
        this->one = new Node();
      }
      one->push(m, b - 1);
    } else {
      if (!zero) {
        this->zero = new Node();
      }
      zero->push(m, b - 1);
    }
  }
  void pop(int m, int b = B - 1) {
    q--;
    if (b == -1) {
      return;
    }
    if (bit(m, b)) {
      if (!one) {
        this->one = new Node();
      }
      one->pop(m, b - 1);
    } else {
      if (!zero) {
        this->zero = new Node();
      }
      zero->pop(m, b - 1);
    }
  }
  int ask(int m, int b = B - 1) {
    if (b == -1) {
      return 0;
    }
    if (bit(m, b)) {
      if (one && one->q > 0) {
        return one->ask(m, b - 1);
      } else {
        return (p2[b] | zero->ask(m, b - 1));
      }
    } else {
      if (zero && zero->q > 0) {
        return zero->ask(m, b - 1);
      } else {
        return (p2[b] | one->ask(m, b - 1));
      }
    }
  }
};
Node root;
void solve() {
  for (int i = 0; i <= B - 1; ++i) {
    p2[i] = (1 << i);
  }
  for (int i = 1; i <= n; ++i) {
    root.push(b[i]);
  }
  for (int i = 1; i <= n; ++i) {
    ans[i] = root.ask(a[i]);
    int resp = (a[i] ^ ans[i]);
    root.pop(resp);
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d ", ans[i]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
  }
  solve();
  return 0;
}
