import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNextInt()) {
int x = sc.nextInt();
int y = sc.nextInt();
Set<Integer> set = new HashSet<>();
while (x != 0) {
set.add(x);
x /= 2;
}
while (y != 0) {
if (set.contains(y)) {
System.out.println(y);
break;
}
set.add(y);
y /= 2;
}
}
}
}

京公网安备 11010502036488号