#include <iostream>
using namespace std;

int main() {
    int x, y;
    while(scanf("%d %d", &x, &y) != EOF){
        while(x != y){ 
            if(x > y){ //依次网上找父节点,直到x==y
                x /= 2;
            }else{
                y /= 2;
            }
        }
        printf("%d\n", x);
    }
}
// 64 位输出请用 printf("%lld")