# a = int(input())
# graph = {}
#
# for _ in range(a):
#     s = input().split()
#     if len(s) > 1:
#         graph[s[0]] = s[2:]
#     else:
#         graph[s[0]] = [s[0]]
#
# b = int(input())
# for _ in range(b):
#     s = input().split()
#     print("Yes" if s[0] in graph[s[1]] else "No")
#
# print(graph) 

# if __name__ == '__main__':
#     main()
