Help me in solving ALIENOR problem

My issue

i need vedio solution

My code

# cook your dish here

Problem Link: ALIEN-OR Practice Coding Problem - CodeChef

# cook your dish here

def innum():
    return int(input())
def inmany():
    return map(int,input().split())
def inlist():
    return list(inmany())

for T in range(innum()):
    
    N,K = inmany()
    
    A = []
    for i in range(N):
        num = input()
        num = int(num,2)
        A.append(num)
    
    k = (2**K)-1
    l = k.bit_length()
    needed = []
    for i in range(l):
        num = 1 << i
        needed.append(num)
    
    possible = True
    if needed in A
    for n in needed:
        if n not in A:
            possible = False
            break
    
    print("YES" if possible else "NO")