Files
PS/swea/1204.py
2024-05-09 01:51:26 +09:00

18 lines
331 B
Python

t=int(input())
for _ in range(1,t+1):
tc=int(input())
arr=list(map(int,input().split()))
cnt={}
mx=(0,0)
for i in arr:
if i in cnt:
cnt[i]+=1
else:
cnt[i]=1
if cnt[i]>mx[1] or (cnt[i]==mx[1] and i>mx[0]):
mx=(i,cnt[i])
print("#"+str(tc),mx[0])