n = int(input())#散列表相关问题可用Python的dict实现
stu = dict()
for i in range(n):
    num = list(map(str, input().split(" ")))
    stu[(num[0])] = [num[1], num[2], num[3]]
m = int(input())
for i in range(m):
    x = input()
    if x in stu:
        print(x, stu[x][0], stu[x][1], stu[x][2])
    else:
        print("No Answer!")