a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
if(set(b) != set(c)):
    print("False")
else:
    temp=[]
    res=[]
    max_len=0
    for i in a:
        if(i in c):
            temp.append(i)
        else:
            if(max_len < len(temp)):
                max_len = len(temp)
                res=temp
                temp=[]
    if(max_len < len(temp)):
                max_len = len(temp)
                res=temp
                temp=[]            
    if(len(res) <= len(b)):
        print("True")
    else:
        print("False")

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: