a = input()
b = input()
num = 0
for i in a:
if i in b:
num += 1
if num == len(a):
print('true')
else:
print('false')
a = input()
b = input()
num = 0
for i in a:
if i in b:
num += 1
if num == len(a):
print('true')
else:
print('false')