CHEFRECP, please tell me what is wrong with my code

Please format your complete code or provide the link of your solution.

Now please check

Say n = 1, you are directly printing “YES” rather than taking the input of recipes. What happens to this unused input? It goes to the next test case. This messes up the input of your program.

I didn’t get where I am wrong

from itertools import groupby
for i in range(int(input())):
    n = int(input())
    c = 0
    a = list(map(int, input().split()))
    g = sorted(a)
    b = [len(list(group)) for key, group in groupby(a)]
    h = [len(list(group)) for key, group in groupby(g)]
    b = sorted(b)
    h = sorted(h)
    #print(b)
    #print(h)
    if(b == h):
    #print(b)
        #b = sorted(b)
        d = [len(list(group)) for key, group in groupby(b)]
        #for i in range(len(b)-1):
     #       if(b[i] == b[i+1]):
      #          c = 0
           # else:
        #     c = 1
        for i in d:
            if(i > 1):
                c = 1
        #print(c)
        if(c == 1):
            print("NO")
        else:
            print("YES")
    else:
        print("NO")

Please provide some testcases

https://www.codechef.com/viewsolution/33412390

MY updated code, please help me to find where i am wrong. Please tell me Just one test case where my solution fail.