Given an array, A. Let x be an element in the array.
x has the maximum frequency in the array. Find the smallest subsegment
of the array which also has x as the maximum frequency element.
Input Format
An integer n representing size of array
n elements of array
Constraints
1 ≤ N ≤ 10^5
1 ≤ A[i] ≤ 10^5
Output Format
The smallest subsegment of the array
Sample Input
8
4 1 1 2 2 1 3 3
Sample Output
1 1 2 2 1
Explanation
The most frequent element is 1.
The smallest subarray that has all occurrences of it is 1 1 2 2 1
Q)
Input Format An integer n representing size of array n elements of array
Constraints 1 ≤ N ≤ 10^5 1 ≤ A[i] ≤ 10^5
Output Format The smallest subsegment of the array
Sample Input 8 4 1 1 2 2 1 3 3
Sample Output 1 1 2 2 1
Explanation The most frequent element is 1. The smallest subarray that has all occurrences of it is 1 1 2 2 1