Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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

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

while True:
    try:
        a = list(map(int, input().split()))
        print(gcd(a[0], a[1]), lcm(a[0], a[1]))
    except EOFError:
        break

Python: def get_gcd(_a, _b):
    if _a % _b == 0:
        return _b
    return get_gcd(_b, _a % _b)


if __name__ == '__main__':
    while True:
        a, b = list(map(int, input().split()))
        gcd = get_gcd(a, b)
        lcm = a * b / gcd
        print(str(gcd) + " " + str(int(lcm)))

Python: def gcd(x,y):
    while y:
        x, y = y, x % y
    return x


def lcm(x,y):
    return x * y // gcd(x,y)


while True:
    try:
        a = list(map(int,input().split()))
        print(gcd(a[0],a[1]),lcm(a[0],a[1]))
    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())
    except EOFError :
        break
    
    a, b = max(a, b), min(a, b)
    x = gcd(a, b)
    print(x, a * b // x)

Python: import sys

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

for line in sys.stdin:
    (a,b)=line.split(" ")
    a=eval(a)
    b=eval(b)
    g=gcd(a,b)
    print("%d %d" % (g,a*b/g))

Python: import sys


def euc(n,m):
    if n == m:
        return m
    elif m == 1 or n == 1:
        return 1
    else:
        return euc(min(n,m), max(n,m)-min(n,m)*int(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: def gcd(a,b):
	if b < 1: return a
	a,b = b,a % b
	return gcd(a,b)
ss = input().split()
while ss:
	a,b = map(int,ss)
	g = gcd(a,b)
	l = int(a*b/g)
	print(g,l)
	try: ss = input().split()
	except EOFError: break

Python: import sys
from fractions import gcd
[print("{}{}".format(gcd(k[0], k[1]), k[0] * k[1] // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

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: def GCD(x, y):
    if(x == 0):
        return(y)
    return(GCD(y % x, x))

def LCM(x, y):
    return(x * y / GCD(x, y))

while(True):
    try:
        a = map(int, raw_input().split())
        if(a[0] > a[1]):
            a[0], a[1] = a[1], a[0]
        print(GCD(a[0], a[1])),
        print(LCM(a[0], a[1]))
    except Exception:
        break

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

Python: from math import gcd

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

Python: import math
import sys

while True:
	try:
		a,b = map(int, input().split())
		p = a
		q = b
		while True:
			r = p%q
			if r == 0:
				x = q
				break
			else:
				p = q
				q = r
		i = 1
		while True:
			if a*i%b == 0:
				y = a*i
				break
			else:
				i = i+1
		print(x,y)
	except EOFError:
		break

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

Python: import sys
def gcd(a,b):
    if a==b:
        return a
    while(b>0):
        a,b = b,a%b
        if b==0:
            return a
def lcm(a,b):
    n=1
    m=1
    while(n*a!=m*b):
        if n*a>m*b:
            m+=1
        elif n*a<m*b:
            n+=1
    return n*a
lines = sys.stdin.readlines()
for line in lines:
    line = line.split(" ")
    inp = []
    for i in line:
        inp.append(int(i))
    inp.sort()
    a = inp[0]
    b = inp[1]
    print("%d %d" % (gcd(a,b),lcm(a,b)))

Python: import sys


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


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

Python: def GCD(x, y):
	while x > 0:
		z = x
		x = y % x
		y = z
	return y

def LCM(x, y):
	X = x / GCD(x, y)
	Y = y / GCD(x, y)
	return X * Y * GCD(x, y)

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: import math

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

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

Python: import sys;

def gcd(a, b):
	if b == 0:
		return a;
	return gcd(b, a % b);
	
def lcm(a, b):
	return a * b // gcd(a, b);

for line in sys.stdin:
	[a, b] = [int(num) for num in line.split()];
	print(str(gcd(a, b)) + ' ' + str(lcm(a, b)));

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

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

Python: def GcdLcm(a, b):
	p = a * b
	if a < b:
		a, b = b, a
	r = a % b
	while r != 0:
		a = b
		b = r
		r = a % b
	return [b, int(p / b)]

while True:
	try:
		a, b = [eval(item) for item in input().split()]
		g, l = GcdLcm(a, b)
		print(str(g), str(l))
	except EOFError:
		break

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

Python: import sys

for line in sys.stdin:
    a, b = map(int, input().split())
    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: class GCD():
    def __init__(self,a,b):
        self.a = a
        self.b = b

    def gcd(self):
        if self.a < self.b:
            self.a, self.b = self.b, self.a
        while self.b:
            self.a, self.b= self.b, self.a % self.b

        return self.a

    def print(self):
        lcm = self.a * self.b // self.gcd()
        print(self.gcd(), lcm)

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: 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