長さ N の整数列 A = (A 1 , A 2 , ..., A N ) と長さ M の整数列 B = (B 1 , B 2 , ..., B M ) が与えられる. A と B の両方に出現する整数をすべて, 1 個ずつ昇順で出力せよ.
Input
入力は以下の形式で標準入力から与えられる.
N M
A 1 A 2 ... A N
B 1 B 2 ... B M
Output
A と B の両方に出現する整数をすべて, 1 個ずつ昇順で出力せよ.各整数は改行で区切ること.
Constraints
1 ≦ N ≦ 100 .
1 ≦ M ≦ 100 .
1 ≦ A i ≦ 100 ( 1 ≦ i ≦ N ).
1 ≦ B j ≦ 100 ( 1 ≦ j ≦ M ).
Example 1
Input
6 5 2 4 6 8 10 12 15 12 9 6 3
Output
6 12
Example 2
Input
3 5 100 100 100 100 100 100 100 100
Output
100
Example 3
Input
1 1 2 5
Output
Example 4
Input
10 10 76 91 98 7 98 7 98 10 63 91 70 71 10 10 91 70 65 10 63 76
Output
10 63 76 91
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.