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 DecimalFormat df = new DecimalFormat("0.00000000");
    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);
    }
    
    static void pn(Object o){
        System.out.println(o);
    }
    
    static void p(Object o){
        System.out.print(o);
    }
    
    static String n(){
        return in.next();
    }
    
    static String nln(){
        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{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        
        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }
 
 
        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
    
}       