Given an array of distinct integers, write a program to find two pairs (a, b) and (c, d) such that ab = cd, where a, b, c and d are distinct elements.
First line of input contains a single integer T which denotes the number of test cases. T test cases follows. First line of each test case contains a single integer N which denotes the number of elements in the array. Second line of each test case contains N space separated integers which denotes elements of the array.
For each test case, print 1 if any such pair is found otherwise print -1.
3 4 7 1 2 9 8
1 6 3 9 2 10
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.