M,N = map(int,input().split())
li_max = []
for i in range(1,min(M,N)+1):
if M%i==0 and N%i==0:
li_max.append(i)
for i in range(max(M,N),M*N+1):
if i%M==0 and i%N==0:
min_n = i
break
print(li_max[-1],min_n)
M,N = map(int,input().split())
li_max = []
for i in range(1,min(M,N)+1):
if M%i==0 and N%i==0:
li_max.append(i)
for i in range(max(M,N),M*N+1):
if i%M==0 and i%N==0:
min_n = i
break
print(li_max[-1],min_n)