#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;


//找路径
void f(int x,vector<int>&v) {
	while (x != 0) {
		v.push_back(x);
		x /= 2;
	}
}
int main() {

	int x, y;
	while (cin >> x >>  y) {
		vector<int>pathx;
		vector<int>pathy;
		f(x,pathx);
		f(y,pathy);
		reverse(pathx.begin(), pathx.end());
		reverse(pathy.begin(), pathy.end());

		int comfather;
		int i = 0;
		for (; i < pathx.size()&&i<pathy.size(); i++) {
			if (pathx[i] != pathy[i])break;
		}
		cout << pathx[i-1] << endl;
	}
	

	return 0;
}