ComputerBrain
Time Limit: 10 Seconds Memory Limit: 65536 KB
ComputerBrain is a famous scientific reality and talent show aiming to find people with exceptional brain power. In one of the challenges, two integer sequences a1, a2, …, an and b1, b2, …, bn of length n are given to the contestant. It's guaranteed that ai != aj and bi != bj hold for all i != j, and there is exactly one integer in the first sequence which also appears in the second sequence. The contestant has to memorize the two sequences in a very short time, and find the integer which appears in both sequences correctly. As a technical staff of the show, you are required to write a program and find out the correct answer.
Input
The first line of the input contains an integer T ≤ 2048, indicating the number of test cases. For each test case, the first line contains an integer n (1 ≤ 105), indicating the length of the sequence. The second line contains n integers a1, a2, …, an (1 ≤ ai ≤ 106), indicating the first sequence. The third line contains n integers b1, b2, …, bn (1 ≤ bi ≤ 106), indicating the second sequence. It's guaranteed that the sum of n over all test cases will not exceed 3 * 105.
Output
For each test case output one line containing one integer, indicating the integer which appears in both sequences.
Sample Input
3 3 3 1 2 5 3 4 2 38324 14122 38323 14122 1 180310 180310
Sample Output
3 14122 180310Submit