#include<iostream> #include<bitset> using namespace std; int main(void) { int a,b; while(cin >> a >> b) { bool f = false; bitset<16>b1(a); bitset<16>b2(b); for(int i = 0; i < 16;i++) { b1 = (b1 >> (16 - i)) | (b1 << i); if(b1 == b2) { f = true; break; } } if(f) cout << "YES\n"; else cout << "NO\n"; } return 0; }