Common elements in three arrays(error) (Deleted)
Submissions: 647   Accuracy:

38.64%

  Difficulty: Easy   Marks: 2

Given three arrays sorted in non-decreasing order, print all common elements in these arrays.If there is no common element print -1.

Input:
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains three integers N1,N2 and N3 denoting the size of each array.
Then three lines follow containing N1,N2 and N3 space-separated integers denoting the elements of each array.

Output:
Print all common elements in these arrays.If there is no common element print -1.

Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 100
0 ≤A[i]<=100

Example:

Input:
2
6 5 8
1 5 10 20 40 80
6 7 20 80 100
3 4 15 20 30 70 80 90
3 5 4
1 5 5
3 4 5 5 10
5 5 10 20

Output:
20 80
5 5

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

Author: vaibhav95


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



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


to report an issue on this page.