#include <stdio.h>

int ComFather (int x, int y){
	if (x == 1 || y == 1){
		return 1;
	}
	while (x != y){
		if (x > y){
			x = x / 2;
		}else{
			y = y / 2;
		}
	}
	return x;
} 

int main () {
	int x, y;
	while (scanf("%d%d", &x, &y) != EOF){
		printf("%d\n", ComFather(x, y));
	}
	return 0;
}