#include <bits/stdc++.h>
using namespace std;
struct Node {
  explicit Node(Node *zero = nullptr, Node *one = nullptr, int cnt = 0)
      : zero(zero), one(one), cnt(cnt) {}
  shared_ptr<Node> zero, one;
  int cnt;
};
class Bor {
 public:
  const int SIZE = 30;
  Bor() : root(new Node()) {}
  void insert(unsigned int num) { insert(root, num, SIZE - 1); }
  void erase(unsigned int num) { erase(root, num, SIZE - 1); }
  unsigned int getBest(unsigned int num) {
    unsigned int res = 0;
    shared_ptr<Node> v = root;
    for (int i = SIZE - 1; i >= 0; --i) {
      if (num & ((unsigned int)1 << i)) {
        if (v->one != nullptr) {
          res |= ((unsigned int)1 << i);
          v = v->one;
        } else {
          v = v->zero;
        }
      } else {
        if (v->zero != nullptr) {
          v = v->zero;
        } else {
          res |= ((unsigned int)1 << i);
          v = v->one;
        }
      }
    }
    erase(root, res, SIZE - 1);
    return res;
  }

 private:
  shared_ptr<Node> root;
  int erase(const shared_ptr<Node> &v, unsigned int num, int pos) {
    if (v == nullptr) {
      return 0;
    }
    if (pos == -1) {
      --v->cnt;
      return v->cnt;
    }
    bool bit = ((num & ((unsigned int)1 << pos)) != 0);
    if (bit) {
      v->cnt = erase(v->one, num, pos - 1);
      if (v->cnt == 0) {
        v->one = nullptr;
      }
      v->cnt += getCnt(v->zero);
    } else {
      v->cnt = erase(v->zero, num, pos - 1);
      if (v->cnt == 0) {
        v->zero = nullptr;
      }
      v->cnt += getCnt(v->one);
    }
    return v->cnt;
  }
  int insert(const shared_ptr<Node> &v, unsigned int num, int pos) {
    if (pos == -1) {
      ++v->cnt;
      return v->cnt;
    }
    bool bit = ((num & ((unsigned int)1 << pos)) != 0);
    if (bit) {
      if (v->one == nullptr) {
        v->one = shared_ptr<Node>(new Node());
      }
      v->cnt = insert(v->one, num, pos - 1);
      v->cnt += getCnt(v->zero);
    } else {
      if (v->zero == nullptr) {
        v->zero = shared_ptr<Node>(new Node());
      }
      v->cnt = insert(v->zero, num, pos - 1);
      v->cnt += getCnt(v->one);
    }
    return v->cnt;
  }
  int getCnt(const shared_ptr<const Node> &v) {
    if (v == nullptr) {
      return 0;
    }
    return v->cnt;
  }
};
class Solver {
 public:
  int n;
  vector<unsigned int> a, p;
  vector<unsigned int> res;
  void InputData() {
    cin >> n;
    a.resize(static_cast<unsigned long>(n));
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    p.resize(static_cast<unsigned long>(n));
    for (int i = 0; i < n; ++i) {
      cin >> p[i];
    }
  }
  void Solve() {
    Bor bor;
    for (int i = 0; i < n; ++i) {
      bor.insert(p[i]);
    }
    for (int i = 0; i < n; ++i) {
      res.push_back(a[i] ^ bor.getBest(a[i]));
    }
  }
  void OutputAnswer() {
    for (int i = 0; i < n; ++i) {
      cout << res[i] << " ";
    }
  }

 private:
};
int main() {
  Solver solver;
  solver.InputData();
  solver.Solve();
  solver.OutputAnswer();
  return 0;
}
