[print(''.join(g))for g in[[e[0][int(f)]for f in e[1]]for e in[c.split(':')for c in input()[:-1].split(';')]]]