BETA

Difficulty Level: Basic

Submissions: 2920 Accuracy:

22.88%

Intersection of two arrays
     

Given two arrays with distinct elements A and B, print intersection (or common elements) of the two arrays.  If no element is common in two arrays, then print Zero.

Input:

The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is N and M,N is the size of array A and M is size of array B.
The second line of each test case contains N input A[i].
The third line of each test case contains M input B[i].

Output:

Print the intersecting elements sorted in ascending order .If no element is common in two array, then print "Zero" without quotes.

Constraints:

1 ≤ T ≤ 50
1 ≤ N, M ≤ 100
1 ≤ A[i], B[i] ≤ 1000

Example:

Input:2
5 3
89 24 75 11 23
89 2 4
6 5
1 2 3 4 5 6
3 4 5 6 7

Output:
89
3 4 5 6

** For More Input/Output Examples Use 'Expected Output' option **

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.