import sys while True: try: n = int(input()) name_list = input().split() name_dic = dict() for name in name_list: name_dic[name] = 0 #候选人得票数 t_n = int(input()) p_list = input().split() invalid = 0 for p in p_list: if p in name_list: name_dic[p] += 1 #统计候选人得票数 else: invalid += 1 for name in name_list: print("{} : {}".format(name, name_dic[name])) print("Invalid : " + str(invalid)) except: # print(sys.exc_info()) break