from collections import defaultdict n = int(input()) names = input().split(" ") m = int(input()) votes = input().split(" ") d = dict() for name in names: d[name] = 0 d["Invalid"] = 0 for vote in votes: if vote not in d: d["Invalid"] += 1 else: d[vote] += 1 for name in names: print("{} : {}".format(name, d[name])) print("Invalid : {}".format(d["Invalid"]))