Ishaan has a craving for sticks. He has N sticks. He observes that some of his sticks are of the same length, and thus he can make squares out of those.

He wants to know how big a square he can make using those sticks as sides. Since the number of sticks is large, he can't do that manually. Can you tell him the maximum area of the biggest square that can be formed.

Also calculate how many such squares can be made using the sticks.

**Input : **

First line of input contains a single integer T denoting the number of test cases.

The first line of each test case contains an integer N denoting number of sticks.

The next line contains N space-separated integers denoting the length of the sticks.

**Output : **

For each test case, print two space-separated integers denoting the maximum area and the number of such squares.

If no square can be formed, print -1.

**Constraints : **

1 <= T <= 100

1 <= N <= 250

1 <= Stick(i) <= 10^3

**Example :
Input : **

3

7

5 3 2 3 6 3 3

9

2 2 2 9 2 2 2 2 2

3

3 3 3

9 1

4 2

-1

**Explaination : **

Case 1 :

1 square of side 3 is formed.

Case 2 :

2 squares of side 2 are formed.

Case 3 :

No square can be formed.

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.

jhasaurabh312 | 138 |

Aaaaarohiiii | 136 |

Harsha_kunchala | 128 |

tushki | 124 |

RajaRajput | 117 |

ARUN_PUNDIR | 617 |

manishgupta8497 | 607 |

Abhimanyu_kumar | 559 |

KhyatiSoneji | 501 |

Aman___Jain | 496 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.