n = int(input()) # 候选的人数 4 ls = input().split() #候选人的名字 A B C D m = int(input()) # 投票的人数 8 tp = input().split() # 票数 # A D E CF A GG A B c = 0 for i in ls: c += tp.count(i) print(i + ' : ' + str(tp.count(i))) # 注意 str(tp.count(i)) print('Invalid : ' + str(m - c))