You are given an array A of a size N.You have to output the elements in non-increasing order of the frequencies. If two numbers have the same frequency print the smaller element first.
Input:
Output:
For each test case print the elements with their frequencies in non-increasing order.
Constraints:
1≤T≤1,000
1≤N≤1,000
1≤A[i]≤106