arr = [input() for _ in range(int(input()))] research = input() for s in arr: if research.lower() in s.lower(): print(s)