str1 = input().split()
a_list = list(str1)
name = input()
print(a_list.count(name) > 0)
print(name in a_list)