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", G, L)
	}
}

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

        if temp == 0:
            ans = self.a
            return ans

        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 fractions as f
while 1:    
    a,b=map(int,input().split())
    print(str(f.gcd(a,b))+' '+str(a*b//f.gcd(a,b)))

Python: import fractions as f
a,b=map(float,input().split())
print(f.gcd(a,b))
print(a*b//f.gcd(a,b))

Python: import math
import sys

for line in sys.stdin.readlines():
#for line in data.split('\n'):
	x,y = [int(s) for s in line.split(' ')]
	G = math.gcd(x,y)
	L = int(x*y/G)
	print(G,L)

Python: #GCD and LCM

while True:
    try:
        a, b = (int(i) for i in input(). split())
        x = a * b
        while True:
            c = a % b
            a = b
            b = c
            if a % b == 0:
                break
        x = x / a
        print("%d %d" % (b, x))
    except:
        break

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)
    
def LCM(a, b, c):
    return int(a/c*b)

for i in list:
    a = i[0]
    b = i[1]
    GCD = Euclide(a, b)
    print(str(GCD)+" "+str(LCM(a, b, GCD)))

Python: import math
import sys

while True:
    try:
        a, b = map(int, input().split())
    except EOFError:
        break
# 最小公倍数
def lcm(a, b):
    return (a*b) // math.gcd(a ,b)
# 出力　
print("{} {}".format(math.gcd(a, b), lcm(a, b)))

Python: import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
if __name__ == '__main__':
    while True:
        try:
            a, b = map(int, input().split())
            print('{0} {1}'.format(math.gcd(a, b), lcm(a, b)))
        except EOFError:
            break

Python: import sys
dataset = sys.stdin.readlines()
 
 
def gcd(a, b):
    if b > a: return gcd(b, a)
    if a % b == 0: return b
    return gcd(b, a % b)
 
def lcd(a, b):
    return a * b // gcd(a, b)
 
for item in dataset:
    a, b = list(map(int, item.split()))
    print(gcd(a, b), lcd(a,b))

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: import sys;

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

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

Python: def gcd(n1,n2):
    if n2==0:
        return n1
    return gcd(n2,n1%n2)

def lcm(n1,n2):
    return n1/gcd(n1,n2)*n2

while True:
    try:
        a,b=[int(i) for i in input().split()]
        print("{} {}".format(int(gcd(a,b)),int(lcm(a,b))))
    except:
        break

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

Python: def gcd(a,b):
    while b != 0:
        a , b = b , a % b
    return a
def lcm(a,b):
    return int(abs(a*b) / gcd(a,b))

while True:
    try:
        a, b = [int(x) for x in input().split()]
    except:
        exit()
    print(gcd(a,b),lcm(a,b))

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

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

Python: import sys


def calc_gcd(x, y):
    """ ?????§??¬?´???°????¨?????????? """
    if y == 0:
        return x
    else:
        return int(calc_gcd(y, x % y))


def calc_lcm(x, y):
    """ ????°???¬?????°????¨?????????? """
    return int((x * y) / calc_gcd(x, y))


if __name__ == '__main__':
    # ??????????????\?????¨???????????????
    for line in sys.stdin:
        x, y = map(int, line.split(' '))
        print('{0} {1}'.format(calc_gcd(x, y), calc_lcm(x, y)))

Python: import math
import sys

for line in sys.stdin:
	x,y = [int(s) for s in line.split(' ')]
	G = math.gcd(x,y)
	L = int(x*y/G)
	print(G,L)

Python: import sys


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


def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)


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

Python: try:
    GCD = 0
    LCM = 0
    while True:
        lists = list(map(int, input().split()))
        l = sorted(lists)
        num = l[0] * l[1]
        while l[0] < l[1]:
            GCD = l[1] - l[0]
            l[1] = GCD
            l = sorted(l)
            LCM = int(num / GCD)
        print(GCD, LCM)
 
        
except EOFError:
    pass

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

def get_input():
    return map(int, input().split(' '))

def gcd(i,j):
    if i > j:
        if i % j == 0:
            return j
        else:
            return gcd(j, i % j)
    else:
        if j % i == 0:
            return i
        else:
            return gcd(i, j % i)
    
def main():
    for line in sys.stdin:
        ls = list(map(int, line.split(' ')))
        g = gcd(ls[0], ls[1])
        print(g, int(ls[0]*ls[1]/g))

if __name__ == '__main__':
    main()

Python: # Vol0005.


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' % (a, b))

if __name__ == "__main__":
    main()

Python: import sys
import math

for line in sys.stdin:
    a,b = map(int, line.split())
    gc = math.gcd(a,b)
    print("{0} {1}".format(gc, a*b//gc))