# Aizu - 0005
def De(a):
    res = []
    tmp = 2
    while a != 1:
        while not (a % tmp):
            a = round(a / tmp)
            res.append(tmp)
        tmp += 1
    return res

while True:
    try:
        tmp = input()
        a = [int(i) for i in tmp.split(' ')]
    except:
        break
    b = De(a[1])
    a = De(a[0])
    pa, pb = 0, 0
    GCD, LCM = 1, 1
    while True:
        if pa == len(a):
            for i in range(pb, len(b)):
                LCM *= b[i]
            break;
        if pb == len(b):
            for i in range(pa, len(a)):
                LCM *= a[i]
            break;
        if a[pa] == b[pb]:
            GCD *= a[pa]
            LCM *= a[pa]
            pa += 1
            pb += 1
            continue
        if a[pa] < b[pb]:
            LCM *= a[pa]
            pa += 1
            continue
        if a[pa] > b[pb]:
            LCM *= b[pb]
            pb += 1
            continue
    print('%d %d'%(GCD, LCM)) def De(a):
    res = []
    tmp = 2
    while a != 1:
        while not (a % tmp):
            a = round(a / tmp)
            res.append(tmp)
        tmp += 1
    return res De res = [] res [] tmp = 2 tmp 2 while a != 1:
        while not (a % tmp):
            a = round(a / tmp)
            res.append(tmp)
        tmp += 1
     a != 1 a 1 while not (a % tmp):
            a = round(a / tmp)
            res.append(tmp)
         not (a % tmp) a % tmp a tmp a = round(a / tmp) a round(a / tmp) round a / tmp a tmp res.append(tmp) res.append res append tmp tmp += 1 tmp 1 return res res a a while True:
    try:
        tmp = input()
        a = [int(i) for i in tmp.split(' ')]
    except:
        break
    b = De(a[1])
    a = De(a[0])
    pa, pb = 0, 0
    GCD, LCM = 1, 1
    while True:
        if pa == len(a):
            for i in range(pb, len(b)):
                LCM *= b[i]
            break;
        if pb == len(b):
            for i in range(pa, len(a)):
                LCM *= a[i]
            break;
        if a[pa] == b[pb]:
            GCD *= a[pa]
            LCM *= a[pa]
            pa += 1
            pb += 1
            continue
        if a[pa] < b[pb]:
            LCM *= a[pa]
            pa += 1
            continue
        if a[pa] > b[pb]:
            LCM *= b[pb]
            pb += 1
            continue
    print('%d %d'%(GCD, LCM)) True try:
        tmp = input()
        a = [int(i) for i in tmp.split(' ')]
    except:
        break
     except:
        break
     break tmp = input() tmp input() input int(i) for i in tmp.split(' ') for i in tmp.split(' ') i tmp.split(' ') tmp.split tmp split ' ' for i in tmp.split(' ') int(i) int i a = [int(i) for i in tmp.split(' ')] a [int(i) for i in tmp.split(' ')] b = De(a[1]) b De(a[1]) De a[1] a 1 a = De(a[0]) a De(a[0]) De a[0] a 0 pa, pb = 0, 0 pa 0 pb 0 GCD, LCM = 1, 1 GCD 1 LCM 1 while True:
        if pa == len(a):
            for i in range(pb, len(b)):
                LCM *= b[i]
            break;
        if pb == len(b):
            for i in range(pa, len(a)):
                LCM *= a[i]
            break;
        if a[pa] == b[pb]:
            GCD *= a[pa]
            LCM *= a[pa]
            pa += 1
            pb += 1
            continue
        if a[pa] < b[pb]:
            LCM *= a[pa]
            pa += 1
            continue
        if a[pa] > b[pb]:
            LCM *= b[pb]
            pb += 1
            continue
     True if pa == len(a):
            for i in range(pb, len(b)):
                LCM *= b[i]
            break;
         pa == len(a) pa len(a) len a for i in range(pb, len(b)):
                LCM *= b[i]
             i range(pb, len(b)) range pb len(b) len b LCM *= b[i] LCM b[i] b i break if pb == len(b):
            for i in range(pa, len(a)):
                LCM *= a[i]
            break;
         pb == len(b) pb len(b) len b for i in range(pa, len(a)):
                LCM *= a[i]
             i range(pa, len(a)) range pa len(a) len a LCM *= a[i] LCM a[i] a i break if a[pa] == b[pb]:
            GCD *= a[pa]
            LCM *= a[pa]
            pa += 1
            pb += 1
            continue
         a[pa] == b[pb] a[pa] a pa b[pb] b pb GCD *= a[pa] GCD a[pa] a pa LCM *= a[pa] LCM a[pa] a pa pa += 1 pa 1 pb += 1 pb 1 continue if a[pa] < b[pb]:
            LCM *= a[pa]
            pa += 1
            continue
         a[pa] < b[pb] a[pa] a pa b[pb] b pb LCM *= a[pa] LCM a[pa] a pa pa += 1 pa 1 continue if a[pa] > b[pb]:
            LCM *= b[pb]
            pb += 1
            continue
     a[pa] > b[pb] a[pa] a pa b[pb] b pb LCM *= b[pb] LCM b[pb] b pb pb += 1 pb 1 continue print('%d %d'%(GCD, LCM)) print '%d %d'%(GCD, LCM) '%d %d' (GCD, LCM) GCD LCM pb += 1 1 pb pb = 0, 0 0 pb pa, pb = 0, 0 0 pa GCD, LCM = 1, 1 1 GCD LCM = 1, 1 1 LCM GCD *= a[pa] a[pa] GCD LCM *= a[pa] a[pa] LCM def De(a):
    res = []
    tmp = 2
    while a != 1:
        while not (a % tmp):
            a = round(a / tmp)
            res.append(tmp)
        tmp += 1
    return res def De(a):
    res = []
    tmp = 2
    while a != 1:
        while not (a % tmp):
            a = round(a / tmp)
            res.append(tmp)
        tmp += 1
    return res De LCM *= b[pb] b[pb] LCM LCM *= a[i] a[i] LCM LCM *= a[pa] a[pa] LCM pa += 1 1 pa b = De(a[1]) De(a[1]) b a = De(a[0]) De(a[0]) a pb += 1 1 pb a = [int(i) for i in tmp.split(' ')] [int(i) for i in tmp.split(' ')] a pa += 1 1 pa LCM *= b[i] b[i] LCM tmp = input() input() tmp
# Aizu - 0005
def De(a):
    res = []
    tmp = 2
    while a != 1:
        while not (a % tmp):
            a = round(a / tmp)
            res.append(tmp)
        tmp += 1
    return res

while True:
    try:
        tmp = input()
        a = [int(i) for i in tmp.split(' ')]
    except:
        break
    b = De(a[1])
    a = De(a[0])
    pa, pb = 0, 0
    GCD, LCM = 1, 1
    while True:
        if pa == len(a):
            for i in range(pb, len(b)):
                LCM *= b[i]
            break;
        if pb == len(b):
            for i in range(pa, len(a)):
                LCM *= a[i]
            break;
        if a[pa] == b[pb]:
            GCD *= a[pa]
            LCM *= a[pa]
            pa += 1
            pb += 1
            continue
        if a[pa] < b[pb]:
            LCM *= a[pa]
            pa += 1
            continue
        if a[pa] > b[pb]:
            LCM *= b[pb]
            pb += 1
            continue
    print('%d %d'%(GCD, LCM))