Problems
Beautiful number
Beautiful number
You are given two sets of non-zero digits.
In decimal notation, we call a positive integer \textbf{beautiful} if it contains at least one digit from each of these sets.
Find the smallest beautiful number.
\InputFile
The first line contains two integers $n$ and $m$ $(1 ≤ n, m ≤ 9)$ - the sizes of the first and second sets. The second line contains $n$ distinct digits $d_1, d_2, ..., d_n$. The third line contains $m$ distinct digits $r_1, r_2, ..., r_m$ $(1 ≤ d_i, r_i ≤ 9)$.
\OutputFile
Print the smallest beautiful number.
\Examples
In the example, there are such beautiful numbers as $13$, $18$, $3451$ and so on. The smallest of them is $13$.
Input example #1
2 2 1 4 8 3
Output example #1
13