Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int {
	if x < y {
		gcd(y, x)
	}
	for 0 < y {
		r := x % y
		x, y = y, r
	}
	return x
}

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

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

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

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

Python: try:
    while True:
        x=list(sorted(map(int, input().split())))
        a=x[0]
        b=x[1]
        while b%a != 0:
            c=a
            a=b%a
            b=c
        print(a, x[0]*x[1]//a)
except EOFError:
    pass

Python: while True:
	ans=""
	try:
		n=input().split()
	except:
		break
	if n=="":
		break
	
	
	a,b=int(n[0]),int(n[1])
	ma,mi=[],[]
	count=2
	while a!=1 and b!=1:
		try:
			check_0=max(a,b)
		except:
			break
		for i in range(count,max(a,b)):
			while a%i==0:
				a/=i
				ma.append(i)
				if b%i==0:
					b/=i
					mi.append(i)
				count=i
				break
			while b%i==0:
				b/=i
				ma.append(i)
				count=i
				break
	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 fractions
while 1:
    try:
        a,b=map(int,input().split())
        c=fractions.gcd(a,b)
        print(c,(a*b)//c)
    except:break

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

r=[list(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: import sys

def main():
    """ ????????? """
    MAX = 2000000000
    istr = sys.stdin.read()
    wi = istr.splitlines()
    for i in wi:
        a, b = list(map(int,i.split()))
        if a < b:
            a, b = b, a

        """ ????????????????????????????????§?????§??¬?´???°????????? """
        x = a
        y = b
        while y > 0:
            z = x % y
            x = y
            y = z

        """ a ??¨ b ????????? a ??¨ b ???????°???¬?´???°??§?????? """
        l = a * b // x

        print("{} {}".format(x,l))

if __name__ == '__main__':
    main()

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 sys

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

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

Python: import math

try:
    while True:
        a, b = list(map(int, input().split()))
        print("{} {}".format(math.gcd(a, b), (a * b) // math.gcd(a, b)))
except Exception as _:
    pass

Python: import fileinput as fi
def gcd_euler(a,b):
    if b == 0: return a
    u = a
    v = b
    r = u % v
    while True:
        if r == 0:return v
        u = v
        v = r
        r = u % v



if __name__ == "__main__":
    for line in fi.input():
        a,b = list(map(int,line.strip().split()))
        if a > b:gcd=gcd_euler(a,b)
        else:gcd=gcd_euler(b,a)
        print(gcd,int((a*b)/gcd))

Python: import math
import sys
def gcd(a,b):
    if b==0:
        return a
    return gcd(b, a%b)
def lcm(a,b):
    return a/gcd(a,b)*b
for l in sys.stdin:
    a=list(map(int,l.split()))
    print("%d %d"%(gcd(a[0],a[1]),lcm(a[0],a[1])))