Genetic Engineering#236

Genetic Engineering

1 second
64 megabytes
Easy (≈1000)

Two arrays in ascending order are given. Find the largest number that appears in both arrays.

Input

The first line of the input file contains the length of the first array (N \le 100000). The next line contains numbers in ascending order.

The second line of the input file contains the length of the second array (M \le 100000). The next line contains numbers in ascending order.

Output

Output the largest number that appears in both arrays, or output -1 if there is no such number.

Examples

Example 1

Loading
Loading