https://www.acmicpc.net/problem/2436
import math
a,b=map(int,input().split())
num=b//a
f=1
l=1
min=1000000000
for i in range(1,int(math.sqrt(num))+1):
c=0
j=0
if num%i==0:
j=num//i
for k in range(2,i+1):
if i%k==0 and j%k==0:
c=1
break
if c==0:
if i+j<=min:
f=i
l=j
min=i+j
print("%d %d" % (f*a,l*a))