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)];
}
}
int x = 0;
for(int p:t.set){
x = p;
break;
}
ans[i] = v[i]^T[x];
remove(root, x, 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{
HashSet<Integer> set;
Node[] child;
public Node(){
set = new HashSet<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+bCkmMSleMV0uc2V0LnNpemUoKT4wKXsKICAgICAgICAgICAgICAgICAgICB0ID0gdC5jaGlsZFsxXigodmFsPj5sKSYxKV07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaW50IHggPSAwOwogICAgICAgICAgICBmb3IoaW50IHA6dC5zZXQpewogICAgICAgICAgICAgICAgeCA9IHA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBhbnNbaV0gPSB2W2ldXlRbeF07CiAgICAgICAgICAgIHJlbW92ZShyb290LCB4LCBMLTEpOwogICAgICAgIH0KICAgICAgICBmb3IoaW50IGk6YW5zKW91dC5hcHBlbmQoaSsiICIpOwogICAgICAgIHBuKG91dC50b1N0cmluZygpKTsKICAgIH0KICAgIAoKICAgIHN0YXRpYyBsb25nIG1vZChsb25nIGEpewogICAgICAgIHJldHVybiAoYSVtb2QrbW9kKSVtb2Q7CiAgICB9CiAgICAKICAgIHN0YXRpYyB2b2lkIGFkZChOb2RlIHJvb3QsIGludCBpLCBpbnQgeCwgaW50IGQpewogICAgICAgIHJvb3Quc2V0LmFkZChpKTsKICAgICAgICBpZihyb290LmNoaWxkWyh4Pj5kKSYxXT09bnVsbClyb290LmNoaWxkWyh4Pj5kKSYxXSA9IG5ldyBOb2RlKCk7CiAgICAgICAgaWYoZD4wKWFkZChyb290LmNoaWxkWyh4Pj5kKSYxXSxpLCB4LGQtMSk7CiAgICB9CiAgICAKICAgIHN0YXRpYyB2b2lkIHJlbW92ZShOb2RlIHJvb3QsIGludCBpLCBpbnQgZCl7CiAgICAgICAgcm9vdC5zZXQucmVtb3ZlKGkpOwogICAgICAgIGlmKGQ+MClyZW1vdmUocm9vdC5jaGlsZFsoVFtpXT4+ZCkmMV0saSxkLTEpOwogICAgfQogICAgCiAgICAKICAgIHN0YXRpYyBjbGFzcyBOb2RlewogICAgICAgIEhhc2hTZXQ8SW50ZWdlcj4gc2V0OwogICAgICAgIE5vZGVbXSBjaGlsZDsKICAgICAgICBwdWJsaWMgTm9kZSgpewogICAgICAgICAgICBzZXQgPSBuZXcgSGFzaFNldDxJbnRlZ2VyPigpOwogICAgICAgICAgICBjaGlsZCA9IG5ldyBOb2RlWzJdOwogICAgICAgIH0KICAgIH0KICAgIAogICAgc3RhdGljIGxvbmcgZ2NkKGxvbmcgYSxsb25nIGIpewogICAgICAgIHJldHVybiAoYj09MCk/YTpnY2QoYixhJWIpOwogICAgfQogICAgCiAgICBzdGF0aWMgdm9pZCBwbihPYmplY3Qgbyl7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKG8pOwogICAgfQogICAgCiAgICBzdGF0aWMgdm9pZCBwKE9iamVjdCBvKXsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50KG8pOwogICAgfQogICAgCiAgICBzdGF0aWMgU3RyaW5nIG4oKXsKICAgICAgICByZXR1cm4gaW4ubmV4dCgpOwogICAgfQogICAgCiAgICBzdGF0aWMgU3RyaW5nIG5sbigpewogICAgICAgIHJldHVybiBpbi5uZXh0TGluZSgpOwogICAgfQogICAgCiAgICBzdGF0aWMgaW50IG5pKCl7CiAgICAgICAgcmV0dXJuIEludGVnZXIucGFyc2VJbnQoaW4ubmV4dCgpKTsKICAgIH0KICAgIAogICAgc3RhdGljIGxvbmcgbmwoKXsKICAgICAgICByZXR1cm4gTG9uZy5wYXJzZUxvbmcoaW4ubmV4dCgpKTsKICAgIH0KICAgIAogICAgc3RhdGljIGRvdWJsZSBuZCgpewogICAgICAgIHJldHVybiBEb3VibGUucGFyc2VEb3VibGUoaW4ubmV4dCgpKTsKICAgIH0KICAgIAogICAgc3RhdGljIGNsYXNzIEZhc3RSZWFkZXJ7CiAgICAgICAgQnVmZmVyZWRSZWFkZXIgYnI7CiAgICAgICAgU3RyaW5nVG9rZW5pemVyIHN0OwogICAgICAgIHB1YmxpYyBGYXN0UmVhZGVyKCl7CiAgICAgICAgICAgIGJyID0gbmV3IEJ1ZmZlcmVkUmVhZGVyKG5ldyBJbnB1dFN0cmVhbVJlYWRlcihTeXN0ZW0uaW4pKTsKICAgICAgICB9CiAgICAgICAgCiAgICAgICAgcHVibGljIEZhc3RSZWFkZXIoU3RyaW5nIHMpIHRocm93cyBFeGNlcHRpb257CiAgICAgICAgICAgIGJyID0gbmV3IEJ1ZmZlcmVkUmVhZGVyKG5ldyBGaWxlUmVhZGVyKHMpKTsKICAgICAgICB9CiAKIAogICAgICAgIFN0cmluZyBuZXh0KCl7CiAgICAgICAgICAgIHdoaWxlIChzdCA9PSBudWxsIHx8ICFzdC5oYXNNb3JlRWxlbWVudHMoKSl7CiAgICAgICAgICAgICAgICB0cnl7CiAgICAgICAgICAgICAgICAgICAgc3QgPSBuZXcgU3RyaW5nVG9rZW5pemVyKGJyLnJlYWRMaW5lKCkpOwogICAgICAgICAgICAgICAgfWNhdGNoIChJT0V4Y2VwdGlvbiAgZSl7CiAgICAgICAgICAgICAgICAgICAgZS5wcmludFN0YWNrVHJhY2UoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gc3QubmV4dFRva2VuKCk7CiAgICAgICAgfQogCiAgICAgICAgU3RyaW5nIG5leHRMaW5lKCl7CiAgICAgICAgICAgIFN0cmluZyBzdHIgPSAiIjsKICAgICAgICAgICAgdHJ5ewogICAgICAgICAgICAgICAgc3RyID0gYnIucmVhZExpbmUoKTsKICAgICAgICAgICAgfWNhdGNoIChJT0V4Y2VwdGlvbiBlKXsKICAgICAgICAgICAgICAgIGUucHJpbnRTdGFja1RyYWNlKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHN0cjsKICAgICAgICB9CiAgICB9CiAgICAKfSAgICA=