Given an array A, Your task is to complete the function printDuplicates which prints the duplicate elements of the given array. If no duplicate element is found print -1.
Note: Auxiliary Space must be O(1) and Time complexity must be O(n).
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains an integer N which denotes number of elements of Array. Second line of each test case contains N space separated integers denoting elements of Array A.
Print the duplicate elements from the array.The order of the output should be as the element found to be repeated.
0 3 1 2
2 3 1 2 3