-
Notifications
You must be signed in to change notification settings - Fork 0
/
38030239.py
46 lines (32 loc) · 844 Bytes
/
38030239.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# cook your dish here
for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
s=[]
for i in range(len(l)):
if l[i] in s:
continue
else:
s.append(l[i])
a=[]
for i in s:
a.append(l.count(i))
s=set(a)
p=[]
for i in s:
b=[]
b.append(i)
b.append(a.count(i))
p.append(b)
for i in range(len(p)):
for j in range(len(p)-i-1):
if p[j][1]<p[j+1][1]:
p[j],p[j+1]=p[j+1],p[j]
s=p[0][1]
l=[]
l.append(p[0][0])
for i in range(1,len(p)):
if p[i][1]==s:
l.append(p[i][0])
l.sort()
print(l[0])