n=int(input())
list1=input().strip().split()
m=int(input())
list2=input().strip().split()

dic1={x:0 for x in list1}
c=0
for x in list2:
    if x in dic1:
        dic1[x]=dic1[x]+1
    else:
        c=c+1
dic1['Invalid']=c

for x in dic1:
    print(x,':',dic1[x],end='\n')