

three arraysTime Limit: 3000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2719 Accepted Submission(s): 892 Problem Description There are three integer arrays $a, b, c$. The lengths of them are all $N$. You are given the full contents of $a$ and $b$. And the elements in $c$ is produced by following equation: $c[i] = a[i]\ XOR\ b[i]$ where $XOR$ is the bitwise exclusive or operation. Now you can rearrange the order of elements in arrays $a$ and $b$ independently before generating the array $c$. We ask you to produce the lexicographically smallest possible array $c$ after reordering $a$ and $b$. Please output the resulting array $c$. Input The first line contains an integer $T$ indicating there are $T$ tests. Each test consists of three lines. The first line contains one positive integer $N$ denoting the length of arrays $a, b, c$. The second line describes the array $a$. The third line describes the array $b$. * $T \le 1000$ * $1 \le N \le 10^5$ * integers in arrays $a$ and $b$ are in the range of $[0, 2^{30})$. * at most $6$ tests with $N > 100$ Output For each test, output a line containing $N$ integers, representing the lexicographically smallest resulting array $c$. Sample Input
Sample Output
Source  
