Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

Python: import sys
sys.setrecursionlimit(10**7)
import fileinput

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

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


for line in sys.stdin:
    x, y = map(int, line.split())
    print(gcd(x,y),lcm(x,y))

Python: import math

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

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

r=[map(int,line.split()) for line in sys.stdin]
for i in r:
    o=gcd(i[0],i[i])
    p=i[0]*i[1]/o
    print(o,p)

Python: from fractions import gcd

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

Python: def gcd(li):
    a=max(li)
    b=min(li)
    while b>0:
        a,b=b,a%b
    return a

def lcm(li):
    return li[0]*li[1]/gcd(li)

while True:
    li=[int(i) for i in input().split(" ")]
    print("%i %i"%(gcd(li),lcm(li)))

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, int((a*b)/g))

Python: import sys
import math

for line in sys.stdin:
    a, b = map(int, line.split(' '))
    gcd = math.gcd(a, b)
    print(gcd, a * b // gcd)

Python: import sys
#from me.io import dup_file_stdin

def gcd(x,y):
    t = x % y
    if(t==0):
        return y
    else:
        return gcd(y, t)

#@dup_file_stdin
def solve():
    for line in sys.stdin:
        x,y = map(int,line.split(" "))
        f = gcd(x,y)
        print("{} {}".format(f, x//f*y))
 
solve()

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: def gcd(a,b):
    big,small=max(a,b),min(a,b)
    while big%small!=0:
        big,small=small,big%small
    return small
 
def lcm(a,b):
    return int(a*b/gcd(a,b))
  
def main():
    while True:
        try:
            IN=input()
            val=IN.split()
            g=gcd(int(val[0]),int(val[1]))
            l=lcm(int(val[0]),int(val[1]))
 
            print(g,l)
        except:
            break
if __name__ == '__main__':
    main()

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

Python: # AOJ 0005 GCD and LCM
# Python3 2018.6.9 bal4u

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: while(1):
    try:
        a, b = map(int, input().split())
    except:
        break

    x = max(a, b)
    y = min(a, b)
    if x % y == 0:
        gcd = y
    else:
        while x % y != 0:
            z = x % y
            x = y
            y = z
        else:
            gcd = z

    lcm = a * b // gcd

    print(gcd, lcm)

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

import fileinput
import math
for line in fileinput.input():
    a, b = map(int, line.split())
    g = gcd(a, b)
    lcm = a * b // g
    print(g, lcm)

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

while True:
    try:
        a, b = list(map(float, input().split()))
    except EOFError:
        break
    if a >= b:
        a, b = b, a
    gcd = GCD(a, b) if b%a != 0 else a
    print("{0} {1}".format(int(gcd), int(a*b/gcd)))

Python: ans=[]
while True:
	try:
		k,l=list(map(int,input().split(" ")))
		init_k=k
		init_l=l
#
		while True:
			if k%l==0:
				gcd=l
				tmp_1=init_k/gcd
				tmp_2=init_l/gcd
				lcm=gcd*tmp_1*tmp_2
				break
			else:
				tmp=k%l
				k=l
				l=tmp
		gcd=int(gcd)
		lcm=int(lcm)
		ans.append(str(gcd)+" "+str(lcm))
	except:
		break

for i in ans:
	print(i)

Python: def gcd(u, v):
    if (v == 0): return u
    return gcd(v, u % v)

def lcm(u, v):
    return (u * v) // gcd(u, v)

while 1:
    try:
        inp = input()
    except EOFError:
        break
    else:
        u, v = inp.split(' ')
        u = int(u)
        v = int(v)
        print(gcd(u, v), lcm(u, v))

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


def LCM(a, b, a_b_GCD):
    return int((a * b) / a_b_GCD)

while True:
    a, b = map(int, input().split(' '))
    a, b = max(a, b), min(a, b)

    print(GCD(a, b), LCM(a, b, GCD(a, b)))

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

def main():
    while 1:
        try:
            a = list(map(int, input().split()))
            b = gcd(a[0],a[1])
            c = a[0]/b*a[1]
            print('%s %d' % (b,c))
        except:
            break
            
if __name__ == "__main__":
    main()

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 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 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: def main():
    a,b=(int(x) for x in input().split())
    a1=a
    b1=b
    while b!=0:
        c=a%b
        a=b
        b=c
    print(a,a1*b1//a)

main()

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

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 math
while True:
    a,b = map(int, input().split())
    print(math.gcd(a, b),a * b // math.gcd(a, b))

Python: import sys

def get_divisor(num):
    divisor_list = []
    for i in range(1, int(num/2)):
        divisor = num / i

        if divisor.is_integer():
            divisor_list.append(i)
            divisor_list.append(int(divisor))
    return list(set(divisor_list))

for line in sys.stdin:
    ab = [int(str_) for str_ in line.split()]

    a_list = get_divisor(ab[0])
    b_list = get_divisor(ab[1])

    matched_list = [b for b in b_list if b in a_list]
    g = max(matched_list)
    l = int(ab[0]*ab[1] / g)
    print("{} {}".format(g, l))

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

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

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

Python: #coding:utf-8

import sys

def gcd(n):
    x = n[0]
    y = n[1]

    while y:
        x, y = y, x % y

    return x


def lcm(n):
    return int(n[0] * n[1] / gcd(n))


if __name__ == '__main__':

    lines = []

    for line in sys.stdin:
        if line == "\n":
            break
        else :
            lines.append([int(item) for item in line.split(" ")])

    for n in lines:
        print(str(gcd(n)) + " " + str(lcm(n)))