#include <stdio.h>
#include <stdbool.h>
//十进制转化为二进制,并用数组输出
void binary(int n, char x[]){
int i = 0;
int temp;
while(n != 0){
temp = n / 2;
x[i] = (n - temp*2);
i++;
n /= 2;
}
}
//数组左移一位
void turnLeft(char x[]){
char temp = x[0];
for (int i = 0; i < 15; ++i) {
x[i] = x[i+1];
}
x[15] = temp;
}
//判断两数组是否不相等,不相等返回true,相等返回false
bool judge(char x1[], char x2[]){
for (int i = 0; i < 15; ++i) {
if (x1[i] != x2[i]){
return true;
}
}
return false;
}
int main(){
int a, b;
while(scanf("%d%d", &a, &b) != EOF){
char x1[16] = {0};
char x2[16] = {0};
binary(a, x1);
binary(b, x2);
int i = 0;
while (judge(x1, x2)){
turnLeft(x1);
i++;
if (i == 16){
printf("NO\n");
return 0;
}
}
printf("YES\n");
}
return 0;
}