Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d\n", G, L)
	}
}

Python: import math

try:
 while 1:
  a,b=map(int,input().split())
  print(math.gcd(a,b),a*b// math.gcd(a, b))
except:
   pass

Python: # This program computes GCD and LCM
# -*- coding: utf-8
import sys


def gcd(a, b):
    while True:
        tmpb = b
        b = a % b
        a = tmpb
        if(b == 1):
            break
    return a


def lcm(a, b):
    for i in range(max([a, b]), a*b + 1):
        if(i % a == 0 and i % b == 0):
            return i
    return a*b


for i in sys.stdin:
    try:
        line = [int(k) for k in i.split(" ")]
        g = gcd(max(line), min(line))
        print(str(g) + " " + str(line[0]*line[1]/g))  # + str(lcm(line[0], line[1]))
    except:
        raise
        exit()

Python: import sys
  
def gcd(m,n):
    return m if n==0 else gcd(n, m%n)

for m,n in [map(int,x.split()) for x in list(sys.stdin)]:
    g = gcd(m,n)
    print(g,m//g*n)

Python: import sys
import fractions
def lcm(a,b):
    return int(a*b/fractions.gcd(a,b))

if __name__ == '__main__':
    for line in sys.stdin:
        a,b = map(int,line.split())
        print(int(fractions.gcd(a,b)),lcm(a,b))

Python: from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
import sys

for line in sys.stdin:
    small, large = sorted(int(n) for n in line .split())
    for i in (n for n in xrange(small, 0, -1) if not small % n):
        if not large % i:
            gcd = i
            break
    for i in xrange(2, small + 1):
        if not i * large % small:
            lcm = i * large
            break
    print(gcd, lcm)

Python: while True:
    try:
        spam=map(int, input().split(' '))
        spam = [i for i in spam]
        spam.sort()
        cola = spam[0] * spam[1]
        while True:
            if spam[0] == 0:
                print(spam[1])
                print(int(cola/spam[1]))
                break
            pre = spam[0]
            spam[0] = spam[1] % spam[0]
            spam[1] = pre
    except:
        break

Python: import sys,math
for e in sys.stdin:
 a,b=map(int, e.split())
 d=a*b
 a = math.gcd(a,b)
 print(a, d//a)

Python: import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


def lcm(a, b, gcd):
    return a * b // gcd


for line in sys.stdin:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a, b, c))

Python: def gcd(a,b):
 if b==0:
  return a
 return gcd(b,a%b)

while True:
 try:
  a,b=[int(i) for i in input().split()]
  print(gcd(a,b),(a*b)//gcd(a,b))
 except EOFError:
  break

Python: def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return min(x,y)
    return round(gcd(min(x,y),q))

def lcm(a, b):
    return  round(a*b / gcd(a, b))

while True:
    try:
        a, b = map(int,input().split())
        print(gcd(a,b),lcm(a,b))
    except EOFError:
        break

Python: import sys

def main():
    for input_line in sys.stdin:
        num1 = int(input_line.split(' ')[0])
        num2 = int(input_line.split(' ')[1])
        
        if num1 <= num2:
            dividend(num1, num2, num1)
        elif num1 > num2:
            dividend(num1, num2, num2)
            
        result.sort(reverse=True)
        greatest_common_divisor = result[0]
        least_common_multiple = num1 * num2 / greatest_common_divisor
        
        print('%s %s' % (greatest_common_divisor, least_common_multiple))
        
def dividend(num1, num2, num):
    for i in range(num).sort(reverse=True):
        divisor = i+1
        if num1 % divisor == 0 and num2 % divisor == 0:
            result.append(divisor)
            break
        
if __name__ == '__main__':
    result = []
    main()

Python: from sys import stdin
import math

def GCD(a,b):
    if(a%b==0):
        return b
    else:
        c = a%b
        return GCD(b,c)

def LCM(a,b):
    gcd = GCD(a,b)
    return int(a*b/gcd)

for line in stdin:
    a,b = line.split(" ")
    a = int(a)
    b = int(b)
    gcd = GCD(a,b)
    lcm = LCM(a,b)

    print(str(gcd)+" "+str(lcm))
    print()

Python: import sys
def main():
    tmp = sys.stdin.readline().split(" ")
    print (tmp[0])
    print (tmp[1])
 
if __name__ == "__main__":
    main()

Python: import math
import sys

for line in sys.stdin:
	x,y = [int(s) for s in line.split(' ')]
	g = math.gcd(x,y)

	a = set()
	b = set()
	i = 1
	while not a & b:
		a = a | {x*i}
		b = b | {y*i}
		i += 1

	ab = a & b
	print(g,*ab)

Python: import sys

def gcd(m, n):
    if n != 0:
        return gcd(n, m % n)
    else:
        return m

for line in sys.stdin.readlines():
    m, n = map(int, line.split())
    g = gcd(m, n)
    l = m * n // g    # LCM
    print(g, ' ', l)

Python: def GCD(a, b):
	if b > a:
		return GCD(b, a)
	elif a % b == 0:
		return b
	return GCD(b, a % b)
		
def LCM(a, b):
	return a * b // GCD(a, b)

import sys
L = sys.stdin.readlines()
for line in L:
	x, y = list(map(int, line.split()))
	print(GCD(x, y), LCM(x, y))

Python: a, b = map(int, input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def acd(a, b):
    return int(a*b / gcd(a,b))

print(gcd(a,b), acd(a,b))

Python: def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
while True:
    try:
        a,b = map(int,input().split())
        print (gcd(a,b),a *b // gcd(a,b))
    except:
        break

Python: while True:
    try:
        (a, b) = map(int, input().split(" "))
        (x, y) = (a, b)
        while (x != 0):
            (x, y) = (y%x, x)
        print("%s %s" %(y, a*b//y))
    except:
        break

Python: import sys


def euc(n,m):
    if max(n,m)%min(n,m) == 0:
        return min(n,m)
    else:
        return euc(min(n,m), max(n,m)%min(n,m))


for line in sys.stdin:
    a,b = [int(i) for i in line.split()]
    print(euc(a,b),int(a*b/euc(a,b)))

Python: t = 0
while t == 0:	
	try:
		x,y=[int(i) for i in input().split()]
	except:
		break
	else:
		a = x * y
		if x < y:
			x,y =y,x
		while y > 0:
			r = x % y
			x = y
			y = r
		print(str(a/x) + " " + str(x))

Python: #2-8
while True:
    try:

        def gcd(a,b):
            if b == 0:
                return a
            else:
                return gcd(b,a%b)

        a = list(map(int,input().split()))
        a.sort()
        a.reverse()
        ans1 = gcd(a[0],a[1])
        ans2 = int(a[0]*a[1]/ans1)

        print(ans1,ans2)
    except:
        break

Python: def gcd(a, b):
    if a > b:
        a, b = b, a
    if a == 0:
        return b
    else:
        return gcd(b % a, a)

try:
    while 1:
        a,b = list(map(int,input().split()))
        c = gcd(a, b)
        print('{} {}'.format(c,int(c * (a/c) * (b/c))))

except Exception:
    pass

Python: def gcd(a,b):
    while True:
        if a > b:
            a %= b
        else:
            b %= a
        if a == 0 or b == 0:
            return max(a,b)

def lcm(a,b,g):
    return int(a*b/g)
from sys import stdin
for l in stdin:
    a,b = list(map(int,l.split()))
    g = gcd(a,b)
    print ("%s %s"%(g,lcm(a,b,g)))

Python: import sys


def g(a,b):
    return g(abs(a-b),a) if a%abs(a-b)!=0 else abs(a-b)

for line in sys.stdin.readlines():
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, a*b//c)

Python: import sys, fractions
[[print("{} {}".format(int(fractions.gcd(t[0], t[1])), int(t[0] * t[1] / fractions.gcd(t[0], t[1])))) for t in [[int(y) for y in x.split()]]] for x in sys.stdin]

Python: import math
a, b = map(int, input().split())
# 最小公倍数
def lcm(a, b):
    return (a*b) // math.gcd(a ,b)
# 出力　
print(math.gcd(a, b))
print(lcm(a, b))