# 输入
I = input().split()[1:]
R = map(str,sorted(map(int,set(input().split()[1:]))))
# 匹配满足条件的I
res = []
for i in R:
# 临时存储结果,为了后面在最前面加入数量
tempI = []
for j in range(len(I)):
if i in I[j]:
tempI.append(j)
tempI.append(I[j])
# 加入数量
if tempI:
res.append(i)
res.append(int(len(tempI)/2))
for j in tempI:
res.append(j)
result = [len(res)]
for i in res:
result.append(i)
for i in result:
print(str(i)+' ',end='')