|Contests||Virtual Contests||Problems||Submit||Runs Status||Rank List||Forum|
Given two array of integers, the task is: find all the integers appears in both of the two arrays and output them is increasing order.
The first line is a single integer n, the test case number. n test cases follows. Each test cases is made up of three lines. In the first line there are two integers m1 and m2 indicating the number of intergers in the two array. The second line contain m1 integers in the first array. The third line contain m2 integers in the second array. Note that All numbers in the input is smaller than 1000.
For each test cases, there is only one line of output, containing the common items of the two array in increasing order, separate two adjacent numbers by a single space and No tailing spaces. If no common items exists, output a blank line.
3 6 5 3 9 2
3 5 3 2 4
9 9 9
9 9 9
2 3 5