Question and Answer from L4-M1
text = input()
first = input()
second = input()
words = text.split()
result = []
for i in range(len(words) - 2):
if words[i] == first and words[i + 1] == second:
result.append(words[i + 2])
for word in result:
print(word)