#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

string IntToChar(int a) //十进制转化为二进制
{
    string str = "";
    while(a != 0)
    {
        str += a % 2 + '0';
        a = a / 2;
    }
    while(str.size() < 16)
        str += '0';
    //逆置字符串
    reverse(str.begin(), str.end());
    /*会运行超时
    char temp;
    int i = 0, j = sizeof(str) - 1;
    while(i < j)
    {
        temp = str[i];
        str[i] = str[j];
        str[j] = temp;
    }
    */
    return str;
}

bool LeftMove(string s1, string s2)
{
    if(s1 == s2)
        return true;
    string left, right, ans;
    for(int i = 1; i < s1.size(); ++i) //枚举出所有情况
    {
        left = s1.substr(0, i);
        right = s1.substr(i);
        ans = right + left;
        if(ans == s2)
            return true;
    }
    return false;
}

int main()
{
    int a, b;
    while(cin >> a >> b)
    {
        string s1 = IntToChar(a);
        string s2 = IntToChar(b);
        if(LeftMove(s1, s2))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}