def count_trailing_zeros(s): count = 0 for c in reversed(s): if c == '0': count += 1 else: break return count def get_a_part(s, b): if b == 0: new_s = s else: new_s = s[:-b] if len(s) > b else '' if not new_s: return '0' if new_s == '1': a_minus1_str = '0' else: a_minus1_str = new_s[:-1] + '0' a_str = a_minus1_str.rstrip('0') or '0' return a_str def decimal_to_bin(num): if num == 0: return '0' res = [] while num > 0: res.append(str(num % 2)) num = num // 2 return ''.join(reversed(res)) or '0' def compare(n1_str, n2_str): if n1_str == '0' and n2_str == '0': return 0 if n1_str == '0': return -1 if n2_str == '0': return 1 b1 = count_trailing_zeros(n1_str) a1_str = get_a_part(n1_str, b1) b2 = count_trailing_zeros(n2_str) a2_str = get_a_part(n2_str, b2) b1_str = decimal_to_bin(b1) b2_str = decimal_to_bin(b2) cmp_b = compare(b1_str, b2_str) if cmp_b != 0: return cmp_b return compare(a1_str, a2_str) n_str = input().strip() m_str = input().strip() if not n_str: n_str = '0' if not m_str: m_str = '0' result = compare(n_str, m_str) print("Yes" if result == -1 else "No")