1. Given an array A. Let X be an element in the array which has the maximum frequency.
2. The task is to find the smallest subarray of the array which also has X as the maximum frequency element.
3. If two or more elements have the same frequency (i.e., maximum frequency) and the same subarray size then print the sub segment which occurs first in the array.
Input Format
First line contains an Integer N denoting size of array. Second line contains N space separated elements.
Output Format
Print the required subarray of the array.
Constraints
1<=N<=10^5 1<=A[i]<=10^5
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
8 4 1 1 2 2 1 3 3
Output
1 1 2 2 1