def g(l):
for i in range(0,len(l),2):
if l[i] not in t: t[l[i]]=l[i+1]
else: t[l[i]]+=l[i+1]
n=int(input());t={};d=list(map(int,input().split()))
s=int(input());d1=list(map(int,input().split()))
g(d);g(d1);x=[]
for i,j in t.items():
if j!=0: x.append((i,j))
if not x: print("NULL!")
else:
for i,j in sorted(x,key=lambda x:-x[0]): print(f"{i}:{j}")