#include<stdio.h>
int main()
{
    int x,y;
    while(scanf("%d %d",&x,&y)!=EOF)
    {
        while(x!=y){
           x>y?(x/=2):(y/=2);
        }
        printf("%d\n",y);
    }
}