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