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