| f | import sys | f | import sys |
| data = sys.stdin.buffer.read() | | data = sys.stdin.buffer.read() |
| n | parts = data.split(b'\x00') | n | fragments = data.split(b'\x00') |
| original_text = parts[0].decode('utf-8') | | text_utf8 = fragments[0].decode('utf-8') |
| fragments = parts[1:] | | check_fragments = fragments[1:] |
| encodings = ['cp866', 'cp1251', 'koi8-r', 'iso8859-5'] | | encodings = ['cp866', 'cp1251', 'koi8-r', 'iso-8859-5'] |
| for fragment in fragments: | | for frag in check_fragments: |
| if not fragment: | | if not frag: |
| continue | | continue |
| found = False | | found = False |
| n | for encoding in encodings: | n | for enc in encodings: |
| try: | | try: |
| t | decoded_fragment = fragment.decode(encoding) | t | s = frag.decode(enc) |
| if decoded_fragment in original_text: | | if s in text_utf8: |
| found = True | | found = True |
| break | | break |
| except UnicodeDecodeError: | | except UnicodeDecodeError: |
| continue | | continue |
| print('Yes' if found else 'No') | | print('Yes' if found else 'No') |