try: n=int(input()) names=input().split() m=int(input()) votes=input().split() res={} for k in names: res[k]=0 res['Invalid']=0 for v in votes: v='Invalid' if v not in names else v res[v]+=1 for k,v in res.items(): print(k,':',v) except Exception as e: print(e)