#include <iostream>
using namespace std;
int main() {
    unsigned short m, n;//16位
    while (cin >> m >> n){
        for (int i = 0; i < 16; i++) {
            if (m == n) {
                cout << "YES" << endl;
                break;
            } else  if (i == 15) cout << "NO" << endl;
            else {//循环左移
                int a = m << 1;
                int b = m >> 15;
                m = b | a;
            }
        }
    }
}