#include <iostream>
using namespace std;
int x, y;
int main() {
    while(cin >> x >> y)
    {
        while(x != y)
        {
            if(x > y)
            {
                x = x / 2;
            }
            else if(x < y)
            {
                y = y / 2;
            }
        }
        cout << x << endl;
    }
}