Help me in solving DOMINANT2 problem

My issue

what’s wrong with my code

My code

# cook your dish here
t=int(input())
for i in range(t):
    n=int(input())
    l=list(map(int,input().split()))
    for j in l:
        if l.count(j)>1:
            print('YES')
            break
    print('NO')

Learning course: Arrays, Strings & Sorting
Problem Link: Dominant Element Practice Problem in Arrays, Strings & Sorting - CodeChef

Your code is only counting whether there’s more than 1 appearance of a number, but that doesn’t solve the problem.

Imagine this test case:
5
1 1 2 2 3

Your code will count twice the number 1, then say yes and break.
But that is not ok, because none of 1 or 2 are dominant.