Help me in solving MISSP problem

My issue

solution of this problem

My code

# cook your dish here
T=int(input("No of the test cases:"))
for i in range(T):
   N=int(input())
   doll=[]
   for i in range(N):
       doll[i]=int(input())
       doll.sort()
       for i in range(N):
        if doll[i]==doll[i+2]:
            i+=2
        elif doll[i]!=doll[i+2]:
            break
        print(doll[i])

Learning course: Arrays, Strings & Sorting
Problem Link: Chef and Dolls Practice Problem in - CodeChef

@supremeleader7
plzz refer the following solution

# cook your dish here
for i in range(int(input())):
    n=int(input())
    l=[]
    for j in range(n):
        l.append(int(input()))
    for j in l:
        if l.count(j)%2==1:
            print(j)
            break