import re import sys for line in sys.stdin: stripped_line = line.strip() words = stripped_line.split(' ') if (len(words) == 2) and (len(words[1]) > 1): if re.match(r'((?!.*a$)([A-Z]|Ł)[a-ząćęłńóśźż]+|Jarema|Kosma)$', words[0]): print(words[1]) else: print('') else: print('')