#include <stdio.h>

int main(){
    unsigned short int a,b;
    int len = sizeof(unsigned short int)*8;
    unsigned short int shifted=0;
    
    while (scanf("%hu %hu",&a,&b)==2){
        bool success=false;
        for(int i=0;i<len;i++){
            shifted = (a<<i)|(a>>len-i);
            if(shifted==b){
                success=true;
                break;
            }
        }
        if(success) printf("YES\n");
        else printf("NO\n");
    }
}