Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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

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

if __name__ == "__main__":
    main()

Python: import math
def main():
    def get_inputs():
        input_list = []
        try:
            while True:
                input_list.append(input())
        except EOFError:
            return input_list

    input_list = get_inputs()
    lcm = lambda a,b: a*b / math.gcd(a,b)
    for str_num in input_list:
        tmp = str_num.split(" ")
        a,b = int(tmp[0]),int(tmp[1])
        x = math.gcd(a,b)
        y = int(lcm(a,b))
        print("{} {}".format(x,y))
    return None


if __name__ == '__main__':
    main()

Python: def euclidean_algorithm(a,b):
  if a == b: return(a)
  if a >  b: return(euclidean_algorithm(a-b,b))
  if a  < b: return(euclidean_algorithm(b-a,a))

inputs=[]
while True:
  try:
    inputs.append( list( map(int,input().split()) ) )
  except EOFError:
    break

for i in inputs:
  gcd = euclidean_algorithm(i[0],i[1])
  lcm = int(i[0]*i[1]/gcd)
  print("{0} {1}".format(gcd,lcm))

Python: import sys

def dividend(num, Q):
    a = Q
    b = (num / Q) * Q
    Q = num - (num / Q) * Q
    if num  == b:
        aaa(a)
        return
    dividend(a, Q)
    
def aaa(greatest_common_divisor):
    least_common_multiple = num1 * num2 / greatest_common_divisor
    print('%s %s' % (greatest_common_divisor, least_common_multiple))
    return

for input_line in sys.stdin:
    num1 = int(input_line.split(' ')[0])
    num2 = int(input_line.split(' ')[1])
    
    if num1 <= num2:
        dividend(num2, num1)
    elif num1 > num2:
        dividend(num1, num2)

Python: import math

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

Python: # Aizu Problem 0006: GCD and LCM
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


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


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


for line in sys.stdin:
    a, b = [int(_) for _ in line.split()]
    print(gcd(a, b), lcm(a, b))

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

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


while True:
	try:
		x,y=map(int,input().split())
		print(gcd(x,y),lcm(x,y))

	except EOFError:
		break

Python: import sys
def main():
    tmp = sys.stdin.readline().split(" ")
    print (str(int(tmp[0])))
    print (str(int(tmp[1])))
 
if __name__ == "__main__":
    main()

Python: while 1:
    try:
        a = list(map(int, input().split()))
        a.sort()
        while a[1]%a[0] != 0:
            a[1] %= a[0]
            a.sort()
        print(str(a[0]))
    except:
        break

Python: from math import gcd
from sys import stdin

for line in stdin:
    a,b = [int(i) for i in line.split()]
    g = gcd(a,b)
    print(g,int(a*b/g))

Python: while True:
    try:
        a,b=map(int,input().split())
        y=a*b
        if b>a:
            a,b=b,a
        
        while a%b:
            x=a
            a,b=b,x%b

        print(b,int(y/b))

    except:
        break

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

Python: def main():
    gcd = lambda n, m : gcd(m, n % m) if m != 0 else n
    while True:
        try:
            n, m = map(int, input().split())

            g = gcd(n, m)
            l = n * m // g

            print(g, l)
        except:
            break

if __name__ == '__main__':
    main()

Python: import sys
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:
    a,b=line.split()
    print(gcd(a,b),lcm(a,b))

Python: from math import gcd
import sys

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