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: while True:
	try:
		n=list(map(int, input().split()))#ファイルの読み込み --.py <--.txt
	except EOFError:
		break
	if n[0]>n[1]:#なくてもいいなあ
		l=n[0]
		s=n[1]
	else:
		l=n[1]
		s=n[0]
	a=l
	b=s
	r=a%b
	while r!=0:
		a=b
		b=r
		r=a%b
	GCD=int(b)
	LCM=int(l*s/b)
	print(GCD, LCM)

Python: import fileinput


def GCD(x, y):
    if y != 0:
        return GCD(y, x % y)
    else:
        return x

for line in fileinput.input():
    x, y = [int(s) for s in line.split()]
    #print("{} {}".format(GCD(x, y), int(x * y/GCD(x, y))))#別にformatでなくてもいい
    print(GCD(x, y),int(x * y/GCD(x, y)))

Python: import math
while True:
    try:
        a,b=(map(int,input().split()))
        x=math.gcd(a,b)
        y=a*b//x
        print(x,y)
    except EOFError:
        break

Python: while True:
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)
    def lcm(a, b):
        return a*b/gcd(a, b)

    try:
        a, b = map(int, input().split())
    except EOFError:
        break
    print(str(gcd(b, a%b)) + " " + str(int(lcm(a, b))))

Python: def GCD(m, n):
    while n:
        m, n = n, m % n
    return m

while True:
    try:
        a, b = map(int, input().split())
    except:
        break
    if a < b:
        a, b = b, a
    gcd = GCD(a, b)
    lcm = (a * b) // gcd
    print(gcd, lcm)

Python: import sys
list = sys.stdin.readlines()

e=0
GCD = 0
def Euclide(a, b):
    if b == 0:
        return a
    if a < b:
        tmp = a
        a = b
        b = tmp
    e = a%b
    return Euclide(b, e)

for i in list:
    i = i.split(' ')
    GCD = Euclide(int(i[0]), int(i[1]))
    print(str(GCD)+" "+str(int(int(i[0])/GCD*int(i[1]))))

Python: import sys

def gcd(x, y):
    return gcd(y, y - x) if x != y else x

for i in sys.stdin:
    a, b = sorted(list(map(int, i.split())))
    g = gcd(a, b)
    print(g, (a*b)//g)

Python: import sys
def main():
    tmp = sys.stdin.readline()
    while tmp:
        tmp = sys.stdin.readline().split("")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        

        tmp = sys.stdin.readline()
        break

        
if __name__ == "__main__":
    main()

Python: import math
def main():
    def get_inputs():
        input_list = []
        try:
            while True:
                input_list.append(input())
        except EOFError:
            return input_list

    input_list = get_inputs()
    lcm = lambda a,b: a*b / math.gcd(a,b)
    for str_num in input_list:
        tmp = str_num.split(" ")
        a,b = int(tmp[0]),int(tmp[1])
        x = math.gcd(a,b)
        y = int(lcm(a,b))
        print("{} {}".format(x,y))
    return None


if __name__ == '__main__':
    main()

Python: import sys
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a,b):
	return a*b//gcd(a,b)
	
sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    print(gcd(a,b), lcm(a, b))

Python: while True:
	try:
		i=list(map(int,input().split()))
		i.sort()
		x=i[:]
		while True:
			if i[1]%i[0]!=0:
				i[0],i[1] = i[1]%i[0],i[1]
			else:
				print(i[0],int(x[0]*x[1]/i[0]))
				break;
	except:
		break;

Python: import fileinput

for line in fileinput.input():
    tokens = list(map(int, line.strip().split()))
    a, b = tokens[0], tokens[1]
    d = a * b
    if a < b:
        tmp = a
        a = b
        b = tmp

    c = a % b
    while(c != 0):
        a = b
        b = c
        c = a % b

    g = b
    l = d / g

    print(str(g)+" "+str(int(l)))

Python: def gcd(n, m):
    while n:
        n, m = m % n, n
    return m

while 1:
    try:
        n, m = map(int, input().split())
        g = gcd(n, m)
        print(g, int(n*m/g))
    except EOFError:
        break

Python: import math

while True :
    try :
        a, b = map(int, input().split())
        Gcd = math.gcd(a, b)
        Lcm = (a * b) // Gcd
        print(Gcd, Lcm) 
    except :
        break

Python: import sys


def euc(n,m):
    if n%m == 0:
        return 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: import sys

nums = []


for line in sys.stdin:
    nums.append(line)

for i in range(len(nums)):
    input_line = nums[i].split(" ")
    a = long(input_line[0])
    b = long(input_line[1])


    #??¬?´???°?????????
    common_div = []

    #?????§??¬?´???°
    if a < b:
        last_num = a
    else:
        last_num = b

    for j in range(1,last_num-1):
        if a%j == 0 and b%j == 0:
            #a???b???j??§???????????¨???
            common_div.append(j)
    
    max_common_div = common_div[len(common_div)-1]
    min_common_mpl = int((a * b)/max_common_div)

    print(str(max_common_div) + " " + str(min_common_mpl))

Python: # -*-coding:utf-8

import fileinput

def main():
    for line in fileinput.input():
        tokens = list(map(int, line.strip().split()))
        a, b = tokens[0], tokens[1]

        if a < b:
            a, b = b, a

        ansGCD = GreatestCommonDivisor(a, b)
        ansLCM = LeastCommonMultiple(a, b)

        print('{0} {1}'.format(ansGCD, ansLCM))

def GreatestCommonDivisor(a, b):
    while b:
        a, b = b, a%b

    return a

def LeastCommonMultiple(a, b):
    return (a*b) / GreatestCommonDivisor(a, b)


if __name__ == '__main__':
    main()

Python: import math
while True:
    try:
        a,b=list(map(int,input().split()))
        print(math.gcd(a,b),a*b//math.gcd(a,b))
    except:break

Python: def gcd(a, b):
    while b != 0:
        y = a % b
        a = b
        b = y
    return a


d = []
m = []
while True:
    try:
        a, b = map(int, input().split())
        if a > b:
            num = gcd(a, b)
        elif a < b:
            num = gcd(b, a)
        else:
            num = a
        d.append(num)
        m.append(int(a*b/num))
    except EOFError:
        break

for i in range(len(d)):
    print(d[i], m[i])

Python: def main():
    while True:
        try:
            a,b = map(int,input().split())
            c = a*b
            if a < b:
                a,b = b,a
            while a%b != 0:
                a,b = b,a%b
            print(b,c//b)
        except EOFError:
            exit()

if __name__ == '__main__':
    main()

Python: import sys
for line in sys.stdin:
    a,b = list(map(int,line.split()))
    ab = a*b
    while b: a,b = b,a%b
    print(a,ab//a)

Python: # Vol0005.
import sys


def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def get_gcd(x, y):
    if x < y: return get_gcd(y, x)
    # x >= yのときはx % yを計算してyとx % yの話にする。
    # ここでx % yのところが0ならばyが求める答えとなる。
    if y == 0: return x
    return get_gcd(y, x % y)

def main():
    data = []
    lines = sys.stdin.readlines()

    for line in lines:
        data.append(line.split())

    N = len(data)
    for i in range(N):
        a = int(data[i][0]); b = int(data[i][1])
        gcd = get_gcd(a, b)
        lcm = (a // gcd) * b
        print('%d %d' % (gcd, lcm))

if __name__ == "__main__":
    main()

Python: def GCD(a, b):
	while b!=0:
		tmp=b
		b=a%b
		a=tmp
	return a
while True:
	try:
		a, b = map(int, input().split())
	except EOFError:
		break
	a, b = (a, b) if a>=b else (b, a)
	gcd=GCD(a,b)
	print(gcd, a*b//gcd)

Python: # -*- coding: utf-8 -*-

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