#include <bits/stdc++.h>
using namespace std;
struct node {
  node *zero = NULL;
  node *one = NULL;
  int c = 0;
};
node *root = new node;
void push(long long x) {
  node *curr = root;
  for (int i = 31; i >= 0; i--) {
    bool temp = (x >> i) & 1;
    if (temp) {
      if (curr->one == NULL) curr->one = new node;
      curr = curr->one;
    } else {
      if (curr->zero == NULL) curr->zero = new node;
      curr = curr->zero;
    }
    curr->c = curr->c + 1;
  }
}
void del(long long x) {
  node *curr = root;
  for (int i = 31; i >= 0; i--) {
    bool temp = (x >> i) & 1;
    if (temp) {
      if (curr->one == NULL) curr->one = new node;
      curr = curr->one;
    } else {
      if (curr->zero == NULL) curr->zero = new node;
      curr = curr->zero;
    }
    curr->c = curr->c - 1;
  }
}
void print(node *curr, long long x, long long i) {
  if (curr->one == NULL && curr->zero == NULL) {
    cout << x << " ";
    return;
  }
  if ((curr->one != NULL) && (curr->one->c)) {
    long long temp = x | (1 << i);
    print(curr->one, temp, i - 1);
  }
  if (curr->zero != NULL && (curr->zero->c)) {
    print(curr->zero, x, i - 1);
  }
}
long long max_XOR(long long x) {
  node *curr = root;
  long long ans = 0;
  for (int i = 31; i >= 0; i--) {
    bool temp = (x >> i) & 1;
    if (temp) {
      if ((curr->zero != NULL) && (curr->zero->c)) {
        curr = curr->zero;
        ans += pow(2, i);
      } else
        curr = curr->one;
    } else {
      if ((curr->one != NULL) && (curr->one->c)) {
        curr = curr->one;
        ans += pow(2, i);
      } else
        curr = curr->zero;
    }
  }
  return ans;
}
long long max_pair(long long x) {
  node *curr = root;
  long long ans = 0;
  for (int i = 31; i >= 0; i--) {
    bool temp = (x >> i) & 1;
    if (temp) {
      if ((curr->zero != NULL) && (curr->zero->c))
        curr = curr->zero;
      else {
        curr = curr->one;
        ans += pow(2, i);
      }
    } else {
      if ((curr->one != NULL) && (curr->one->c)) {
        curr = curr->one;
        ans += pow(2, i);
      } else
        curr = curr->zero;
    }
  }
  return ans;
}
long long min_XOR(long long x) {
  node *curr = root;
  long long ans = 0;
  for (int i = 31; i >= 0; i--) {
    bool temp = (x >> i) & 1;
    if (!temp) {
      if ((curr->zero != NULL) && (curr->zero->c))
        curr = curr->zero;
      else {
        curr = curr->one;
        ans += pow(2, i);
      }
    } else {
      if ((curr->one != NULL) && (curr->one->c))
        curr = curr->one;
      else {
        curr = curr->zero;
        ans += pow(2, i);
      }
    }
  }
  return ans;
}
long long min_pair(long long x) {
  node *curr = root;
  long long ans = 0;
  for (int i = 31; i >= 0; i--) {
    bool temp = (x >> i) & 1;
    if (!temp) {
      if ((curr->zero != NULL) && (curr->zero->c))
        curr = curr->zero;
      else {
        curr = curr->one;
        ans += pow(2, i);
      }
    } else {
      if ((curr->one != NULL) && (curr->one->c)) {
        curr = curr->one;
        ans += pow(2, i);
      } else
        curr = curr->zero;
    }
  }
  return ans;
}
const long long N = 3e5 + 3;
long long n, a[N], x;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> x, push(x);
  for (int i = 1; i <= n; i++)
    cout << min_XOR(a[i]) << " ", del(min_pair(a[i]));
}
