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.

**Input:**

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.

**Output:**

For each test case, print 1 if any such pair is found otherwise print -1.

**Constraints:**

1<=T<=100

1<=N<=10000

**Example:**

**Input:**

2

7

3 4 7 1 2 9 8

6

1 6 3 9 2 10

**Output:**

1

1

Author: harsh.agarwal0

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.

PM_Pranay | 38 |

m_raju | 22 |

Piyush_43 | 22 |

abducodes | 22 |

RamduttSharma | 18 |

Pulkit__Sharma__ | 626 |

Anirban166 | 503 |

abducodes | 468 |

Found_me | 430 |

Yo_Nehru | 404 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4559 |

Login to report an issue on this page.