Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

Python: def digits(n):
    if n < 10: return 1
    c = 0
    while n > 0:
        c += 1
        n = n // 10

    return c

while 1:
    try:
        inp = input()
    except EOFError:
        break
    else:
        n, m = inp.split(' ')
        n = int(n)
        m = int(m)
        print(digits(n + m))

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

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 sys;import math;print("\n".join(["{} {}".format(math.gcd(a,b), a // math.gcd(a,b) * b) for x in sys.stdin for a, b in [[int(y) for y in x.split()]] ]))

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

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

for i in input():
	a,b = map(int, i.split())
	print("{0} {1}".format(gcd(a,b),lcm(a,b)))

Python: #!/usr/bin/env python3

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

	gcd=0
	for i in range(a):
		if(a%i==0 and b%i==0):
			gcd=i
	lcm=a*b/gcd
	print("{0} {1}".format(gcd, lcm))

Python: class GCD():
    def __init__(self,a,b):
        self.a = a
        self.b = b

    def swap(self):
        temp = self.a
        self.a = self.b
        self.b = temp

    def gcd(self):
        if self.b < self.a:
            self.swap()

        temp = self.b % self.a
        ans = self.b % temp

        return ans

    def lcm(self):
        gcd = self.gcd()
        temp = self.a * self.b
        ans = temp // gcd
        return gcd,ans

    def print(self):
        num = self.lcm()
        print("{0} {1}".format(num[0],num[1]))

def main():
    data = []

    while 1:
        try:
            n = input().split()

            a = int(n[0])
            b = int(n[1])

            data.append(GCD(a, b))

        except EOFError:
            break

    for array in data:
        array.print()

if __name__ == "__main__":
    main()

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

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

Python: import sys
import fractions

lines = []
for line in sys.stdin:
    num = line.split(" ")
    a, b = int(num[0]), int(num[1])
    gcd = fractions.gcd(a, b)
    print("{0} {1}".format(gcd, (a*b)/gcd))

Python: import sys
a=[map(int,i.split())for i in sys.stdin]
for i,j in a:
	c,d=i,j
	while d:
		if c > d:c,d = d,c
		d%=c
	print(c,i//c*j)

Python: import sys

#最大公約数
def gcd(x, y):
    s = x / y
    r = x % y
    if r == 0:
        return y
    else:
        return gcd(y, r)

#最小公倍数
def lcm(x, y):
    return x*y/gcd(x, y)

def main():
    #print ("a")
    for line in iter(sys.stdin.readline, ""):
        #print (line)
        #tmp = sys.stdin.readline().split(" ")
        #print ("b")
        tmp = line.split(" ")
    
        a = int(tmp[0])
        b = int(tmp[1])
        #print ("a="+str(a))
        #print ("b="+str(b))
        #b = sys.stdin.readline()
        #print ("d")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        print (str(gcd(c, d)) + " " + str(int(lcm(c,d))))

        #tmp = sys.stdin.readline()
        #if len(tmp) == 1:
        #    break
        #else:
        #    tmp = tmp.split(" ")

    #print ("exit")
     
if __name__ == "__main__":
    main()

Python: def pd(n):
    i = 2
    ans = []
    while i ** 2 <= n:
        while n % i == 0:
            n /= i
            ans.append(i)
        i += 1
    if n > 1:
        ans.append(n)
    return ans

def gcd(a, b):
    gcd = 1
    pd_a = pd(a)
    pd_b = pd(b)
    for i in pd_a:
        if i in pd_b:
            pd_b.remove(i)
            gcd *= i
    return int(gcd)

def lcm(a, b):
    lcm = a
    pd_a = pd(a)
    pd_b = pd(b)
    for i in pd_a:
        if i in pd_b:
            pd_b.remove(i)
    for j in pd_b:
        lcm *= j
    return int(lcm)

while True:
    s = input()
    if not s:
        break
    a,b = [int(i) for i in s.split(' ')]
    print(gcd(a, b), lcm(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(x) + " " + str(a / x))

Python: a,b=map(int,input().split())
for i in range(1,a+1):
    f=(b*i)%a
    lcm=(b*i)
    if f==0:
        break
for j in range(1,a+1):
    if a%j==0 and b%j==0 and j*lcm==a*b:
        print(j,lcm)

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

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

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

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

Python: def gcd(y, x):
    if x == 0:
        return y
    return gcd(x, y%x)
try:
    while True:
        a, b = sorted(map(int, input().split()), reverse=True)
        print(gcd(a,b), a*b//gcd(a,b))
except:
    pass

Python: while True:
	ans=""
	try:
		n=input().split()
	except:
		break
	
	a,b=int(n[0]),int(n[1])
	ma,mi=[],[]
	
	for i in range(2,max(a,b)):
		while a%i==0:
			a/=i
			ma.append(i)
			if b%i==0:
				b/=i
				mi.append(i)
		while b%i==0:
			b/=i
			ma.append(i)
	check=1
	for i in mi:
		check*=i
	ans+=str(check)+" "
	check=1
	for i in ma:
		check*=i
	ans+=str(check)
	print(ans)

Python: import math

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

Python: import sys
for i in sys.stdin:
    a,b=map(int,i.split())
    if a<b:a,b=b,a
    def gcd(x,y):
        while y>0:x,y=y,x%y
        return x
    def lcm(x,y):
         return x*y/gcd(x,y)
    print(gcd(a,b),int(lcm(a,b)))

Python: def main():
    while True:
        try:
            a,b=(int(x) for x in input().split())
        except:
            break
        a1=a
        b1=b
        while b!=0:
            c=a%b
            a=b
            b=c
        print(a, a1*b1//a)

main()

Python: import sys
  
for s in sys.stdin:
    m,n = map(int,s.split())
    g,r = m,n
    while r!=0:
      g,r = r,g%r
    print(g,m//g*n)

Python: def main():
    while True:
        try:
            a, b = map(int, input().split())
            
            gcd = rec(a, b)
            lcm = a * b / gcd

            print(gcd, int(lcm))
        except:
            break

def rec(i, j):
    if i % j == 0:
        return j
    return rec(j, i % j)

if __name__ == '__main__':
    main()