class Dome:
def caozuo(self, shuru: str, ceshi: str):
shuchu = shuru.split(',')
c = len(shuchu)
l = []
for i in range(c):
l.append(shuchu[i].split(':'))
jieguo = ''
for i in range(len(l)):
if l[i][1] == ceshi:
jieguo = jieguo + "," + l[i][0]
if jieguo != '':
return jieguo[1:]
else:
jieguo = 'NONE'
return jieguo
if __name__ == '__main__':
d = Dome
shuru = input("shuruneirong:")
ceshi = input('shuru:')
print(d().caozuo(shuru, ceshi))