Check Subset

  • + 0 comments
    T = int(input())
    for i in range(T):
        ele_A = int(input())
        A = set(map(int, input().split()))
        ele_B = int(input())
        B = set(map(int, input().split()))
    
        comm = list(A.intersection(B))
        flag = False
        if len(comm) == len(A):
            flag = True
            if len(comm) == 0:
                flag = False
            else:
                for digit in comm:
                    if digit not in B:
                        flag = False
                        break
            print(flag)
        else:
            print(flag)