count = 1
ipdict = {}
while True:
    try:
        ip = input()
        ipdict[count] = ip
        count += 1
    except:
        break
# print(ipdict)
i = 1
status = 0
while i < len(ipdict):
    for a in ipdict[i]:
        if a in ipdict[i+1]:
            pass
        else:
#             print(a, ipdict[i + 1])
            status = 1
    if status == 1:
        print("false")
        status = 0
    else:
        print("true")
    
    i += 2