Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 4013
Super Brain

Time Limit: 1 Second      Memory Limit: 65536 KB

Super Brain is a famous scientific reality and talent show aiming to find people with exceptional brainpower.

In one of the challenges, two integer sequences \(a_1, a_2, \dots, a_n\) and \(b_1, b_2, \dots, b_n\) of length \(n\) are given to the contestant. It's guaranteed that \(a_i \ne a_j\) and \(b_i \ne b_j\) hold for all \(i \ne 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 integer.

Input

There are multiple test cases. The first line of the input contains an integer \(T\), indicating the number of test cases. For each test case:

The first line contains an integer \(n\) (\(1 \le n \le 10^5\)), indicating the length of the sequence.

The second line contains \(n\) integers \(a_1, a_2, \dots, a_n\) (\(1 \le a_i \le 10^6\)), indicating the first sequence.

The third line contains \(n\) integers \(b_1, b_2, \dots, b_n\) (\(1 \le b_i \le 10^6\)), indicating the second sequence.

It's guaranteed that \(a_i \ne a_j\) and \(b_i \ne b_j\) hold for all \(i \ne j\), and there is exactly one integer in the first sequence which also appears in the second sequence.

It's also guaranteed that the sum of \(n\) over all test cases will not exceed \(3 \times 10^5\).

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
180310

Author: WENG, Caizhi
Source: ZOJ Monthly, March 2018
Submit    Status