import math import functools def my_gcd(*integers): return functools.reduce(math.gcd, integers) l, r = map(int, input().split()) num = list() for i in range(l, r+1): n = int(math.pow(i,i)) num.append(n) print(my_gcd(*num))