import java.util.*;
import java.io.*;
import java.text.*;
class Code{
static final long MOD = (long)1e9+7, mod = 1;
static int MAX = (int)1e6+1;
static int INF = (int)1e9;
static final double eps = (double)1e-9;
static FastReader in;
static final int L = 31;
static int N;
static int[] v, T;
static StringBuilder out = new StringBuilder("");
public static void main
(String[] args
){ in = new FastReader();
int N = ni();
v = new int[N]; T = new int[N];
for(int i = 0; i< N; i++)v[i] = ni();
Node root = new Node();
for(int i = 0; i< N; i++){
T[i] = ni();
add(root, i, T[i], L-1);
}
int[] ans = new int[N];
for(int i = 0; i< N; i++){
int val = v[i];
Node t = root;
for(int l = L-1; l>=0; l--){
if(t.child[(val>>l)&1] != null && t.child[(val>>l)&1].set.size()>0){
t = t.child[(val>>l)&1];
}else if(t.child[((val>>l)&1)^1] != null && t.child[((val>>l)&1)^1].set.size()>0){
t = t.child[1^((val>>l)&1)];
}
}
ans[i] = v[i]^T[t.set.first()];
remove(root, t.set.first(), L-1);
}
for(int i:ans)out.append(i+" ");
pn(out.toString());
}
static long mod(long a){
return (a%mod+mod)%mod;
}
static void add(Node root, int i, int x, int d){
root.set.add(i);
if(root.child[(x>>d)&1]==null)root.child[(x>>d)&1] = new Node();
if(d>0)add(root.child[(x>>d)&1],i, x,d-1);
}
static void remove(Node root, int i, int d){
root.set.remove(i);
if(d>0)remove(root.child[(T[i]>>d)&1],i,d-1);
}
static class Node{
TreeSet<Integer> set;
Node[] child;
public Node(){
set = new TreeSet<Integer>();
child = new Node[2];
}
}
static long gcd(long a,long b){
return (b==0)?a:gcd(b,a%b);
}
}
}
return in.next();
}
return in.nextLine();
}
static int ni(){
return Integer.
parseInt(in.
next()); }
static long nl(){
return Long.
parseLong(in.
next()); }
static double nd(){
return Double.
parseDouble(in.
next()); }
static class FastReader{
public FastReader(){
}
}
while (st == null || !st.hasMoreElements()){
try{
e.printStackTrace();
}
}
return st.nextToken();
}
try{
str = br.readLine();
e.printStackTrace();
}
return str;
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5pby4qOwppbXBvcnQgamF2YS50ZXh0Lio7CmNsYXNzIENvZGV7CiAgICBzdGF0aWMgZmluYWwgbG9uZyBNT0QgPSAobG9uZykxZTkrNywgbW9kID0gMTsKICAgIHN0YXRpYyBpbnQgTUFYID0gKGludCkxZTYrMTsKICAgIHN0YXRpYyBpbnQgSU5GID0gKGludCkxZTk7CiAgICBzdGF0aWMgZmluYWwgZG91YmxlIGVwcyA9IChkb3VibGUpMWUtOTsKICAgIHN0YXRpYyBEZWNpbWFsRm9ybWF0IGRmID0gbmV3IERlY2ltYWxGb3JtYXQoIjAuMDAwMDAwMDAiKTsKICAgIHN0YXRpYyBGYXN0UmVhZGVyIGluOwogICAgc3RhdGljIGZpbmFsIGludCBMID0gMzE7CiAgICBzdGF0aWMgaW50IE47CiAgICBzdGF0aWMgaW50W10gdiwgVDsKICAgIHN0YXRpYyBTdHJpbmdCdWlsZGVyIG91dCA9IG5ldyBTdHJpbmdCdWlsZGVyKCIiKTsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpewogICAgICAgIGluID0gbmV3IEZhc3RSZWFkZXIoKTsKICAgICAgICBpbnQgTiA9IG5pKCk7CiAgICAgICAgdiA9IG5ldyBpbnRbTl07IFQgPSBuZXcgaW50W05dOwogICAgICAgIGZvcihpbnQgaSA9IDA7IGk8IE47IGkrKyl2W2ldID0gbmkoKTsKICAgICAgICBOb2RlIHJvb3QgPSBuZXcgTm9kZSgpOwogICAgICAgIGZvcihpbnQgaSA9IDA7IGk8IE47IGkrKyl7CiAgICAgICAgICAgIFRbaV0gPSBuaSgpOwogICAgICAgICAgICBhZGQocm9vdCwgaSwgVFtpXSwgTC0xKTsKICAgICAgICB9CiAgICAgICAgaW50W10gYW5zID0gbmV3IGludFtOXTsKICAgICAgICBmb3IoaW50IGkgPSAwOyBpPCBOOyBpKyspewogICAgICAgICAgICBpbnQgdmFsID0gdltpXTsKICAgICAgICAgICAgTm9kZSB0ID0gcm9vdDsKICAgICAgICAgICAgZm9yKGludCBsID0gTC0xOyBsPj0wOyBsLS0pewogICAgICAgICAgICAgICAgaWYodC5jaGlsZFsodmFsPj5sKSYxXSAhPSBudWxsICYmIHQuY2hpbGRbKHZhbD4+bCkmMV0uc2V0LnNpemUoKT4wKXsKICAgICAgICAgICAgICAgICAgICB0ID0gdC5jaGlsZFsodmFsPj5sKSYxXTsKICAgICAgICAgICAgICAgIH1lbHNlIGlmKHQuY2hpbGRbKCh2YWw+PmwpJjEpXjFdICE9IG51bGwgJiYgdC5jaGlsZFsoKHZhbD4+bCkmMSleMV0uc2V0LnNpemUoKT4wKXsKICAgICAgICAgICAgICAgICAgICB0ID0gdC5jaGlsZFsxXigodmFsPj5sKSYxKV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYW5zW2ldID0gdltpXV5UW3Quc2V0LmZpcnN0KCldOwogICAgICAgICAgICByZW1vdmUocm9vdCwgdC5zZXQuZmlyc3QoKSwgTC0xKTsKICAgICAgICB9CiAgICAgICAgZm9yKGludCBpOmFucylvdXQuYXBwZW5kKGkrIiAiKTsKICAgICAgICBwbihvdXQudG9TdHJpbmcoKSk7CiAgICB9CiAgICAKCiAgICBzdGF0aWMgbG9uZyBtb2QobG9uZyBhKXsKICAgICAgICByZXR1cm4gKGElbW9kK21vZCklbW9kOwogICAgfQogICAgCiAgICBzdGF0aWMgdm9pZCBhZGQoTm9kZSByb290LCBpbnQgaSwgaW50IHgsIGludCBkKXsKICAgICAgICByb290LnNldC5hZGQoaSk7CiAgICAgICAgaWYocm9vdC5jaGlsZFsoeD4+ZCkmMV09PW51bGwpcm9vdC5jaGlsZFsoeD4+ZCkmMV0gPSBuZXcgTm9kZSgpOwogICAgICAgIGlmKGQ+MClhZGQocm9vdC5jaGlsZFsoeD4+ZCkmMV0saSwgeCxkLTEpOwogICAgfQogICAgCiAgICBzdGF0aWMgdm9pZCByZW1vdmUoTm9kZSByb290LCBpbnQgaSwgaW50IGQpewogICAgICAgIHJvb3Quc2V0LnJlbW92ZShpKTsKICAgICAgICBpZihkPjApcmVtb3ZlKHJvb3QuY2hpbGRbKFRbaV0+PmQpJjFdLGksZC0xKTsKICAgIH0KICAgIAogICAgCiAgICBzdGF0aWMgY2xhc3MgTm9kZXsKICAgICAgICBUcmVlU2V0PEludGVnZXI+IHNldDsKICAgICAgICBOb2RlW10gY2hpbGQ7CiAgICAgICAgcHVibGljIE5vZGUoKXsKICAgICAgICAgICAgc2V0ID0gbmV3IFRyZWVTZXQ8SW50ZWdlcj4oKTsKICAgICAgICAgICAgY2hpbGQgPSBuZXcgTm9kZVsyXTsKICAgICAgICB9CiAgICB9CiAgICAKICAgIHN0YXRpYyBsb25nIGdjZChsb25nIGEsbG9uZyBiKXsKICAgICAgICByZXR1cm4gKGI9PTApP2E6Z2NkKGIsYSViKTsKICAgIH0KICAgIAogICAgc3RhdGljIHZvaWQgcG4oT2JqZWN0IG8pewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihvKTsKICAgIH0KICAgIAogICAgc3RhdGljIHZvaWQgcChPYmplY3Qgbyl7CiAgICAgICAgU3lzdGVtLm91dC5wcmludChvKTsKICAgIH0KICAgIAogICAgc3RhdGljIFN0cmluZyBuKCl7CiAgICAgICAgcmV0dXJuIGluLm5leHQoKTsKICAgIH0KICAgIAogICAgc3RhdGljIFN0cmluZyBubG4oKXsKICAgICAgICByZXR1cm4gaW4ubmV4dExpbmUoKTsKICAgIH0KICAgIAogICAgc3RhdGljIGludCBuaSgpewogICAgICAgIHJldHVybiBJbnRlZ2VyLnBhcnNlSW50KGluLm5leHQoKSk7CiAgICB9CiAgICAKICAgIHN0YXRpYyBsb25nIG5sKCl7CiAgICAgICAgcmV0dXJuIExvbmcucGFyc2VMb25nKGluLm5leHQoKSk7CiAgICB9CiAgICAKICAgIHN0YXRpYyBkb3VibGUgbmQoKXsKICAgICAgICByZXR1cm4gRG91YmxlLnBhcnNlRG91YmxlKGluLm5leHQoKSk7CiAgICB9CiAgICAKICAgIHN0YXRpYyBjbGFzcyBGYXN0UmVhZGVyewogICAgICAgIEJ1ZmZlcmVkUmVhZGVyIGJyOwogICAgICAgIFN0cmluZ1Rva2VuaXplciBzdDsKICAgICAgICBwdWJsaWMgRmFzdFJlYWRlcigpewogICAgICAgICAgICBiciA9IG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgSW5wdXRTdHJlYW1SZWFkZXIoU3lzdGVtLmluKSk7CiAgICAgICAgfQogICAgICAgIAogICAgICAgIHB1YmxpYyBGYXN0UmVhZGVyKFN0cmluZyBzKSB0aHJvd3MgRXhjZXB0aW9uewogICAgICAgICAgICBiciA9IG5ldyBCdWZmZXJlZFJlYWRlcihuZXcgRmlsZVJlYWRlcihzKSk7CiAgICAgICAgfQogCiAKICAgICAgICBTdHJpbmcgbmV4dCgpewogICAgICAgICAgICB3aGlsZSAoc3QgPT0gbnVsbCB8fCAhc3QuaGFzTW9yZUVsZW1lbnRzKCkpewogICAgICAgICAgICAgICAgdHJ5ewogICAgICAgICAgICAgICAgICAgIHN0ID0gbmV3IFN0cmluZ1Rva2VuaXplcihici5yZWFkTGluZSgpKTsKICAgICAgICAgICAgICAgIH1jYXRjaCAoSU9FeGNlcHRpb24gIGUpewogICAgICAgICAgICAgICAgICAgIGUucHJpbnRTdGFja1RyYWNlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHN0Lm5leHRUb2tlbigpOwogICAgICAgIH0KIAogICAgICAgIFN0cmluZyBuZXh0TGluZSgpewogICAgICAgICAgICBTdHJpbmcgc3RyID0gIiI7CiAgICAgICAgICAgIHRyeXsKICAgICAgICAgICAgICAgIHN0ciA9IGJyLnJlYWRMaW5lKCk7CiAgICAgICAgICAgIH1jYXRjaCAoSU9FeGNlcHRpb24gZSl7CiAgICAgICAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBzdHI7CiAgICAgICAgfQogICAgfQogICAgCn0gICAgICAg