Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

Python: import math

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

    except:
        break

Python: while True:
    a,b = map(int, input().split())
    if a < b:
        a,b = b,a

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

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

    print(gcd(a,b), int(lcm(a,b)))

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: #! /usr/lib/python3

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

while True:
    try:
        a, b=map(int, input().split())
        s=gcd(a,b)
        print("{0} {1:.0f}".format(s,a*b/s))
    except:
        break

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

def main():
    while True:
        try:
            i, j = map(int, input().split())

            gcd = rec(i, j)
            lcm = i * j // gcd

            print(gcd, lcm)
        except:
            break

if __name__ == '__main__':
    main()

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 sys

def main():
    for input_line in sys.stdin:
        num1 = int(input_line.split(' ')[0])
        num2 = int(input_line.split(' ')[1])
        
        if num1 <= num2:
            dividend(num1, num2, num1)
        elif num1 > num2:
            dividend(num1, num2, num2)
            
        result.sort(reverse=True)
        greatest_common_divisor = result[0]
        least_common_multiple = num1 * num2 / greatest_common_divisor
        
        print('%s %s' % (greatest_common_divisor, least_common_multiple))
        
def dividend(num1, num2, num):
    for i in range(num):
        divisor = i+1
        if num1 % divisor == 0 and num2 % divisor == 0:
            result.append(divisor)
            
if __name__ == '__main__':
    result = []
    main()

Python: while True:
    try:
        a,b,c,d,e,f = [int(x) for x in input().split()]
        x = (c*e-b*f)/(a*e-b*d)
        y = (c*d-a*f)/(b*d-a*e)
        print('{:>.3f},{:>.3f}'.format(x,y))
    except:
        break

Python: import sys

temp = []
largest = 1

for line in sys.stdin:
    a,b = [int(x) for x in line.split()]
    if a > b:
        x,y = a,b
    else:
        x,y = b,a
    i = x
    while i > 1:
        if (x % i) == 0 and (y % i) == 0:
            x = x / i
            y = y / i
            largest *= i
        i -= 1
    smallest = largest * (a/largest) * (b/largest)
    print('%d %d' % (largest, smallest))
    largest = 1

Python: import sys

ary=[]
ans=[]
def gcd(a,b):
    x=sorted([a,b])
    while x[1]%x[0]!=0:
        dif=x[1]%x[0]
        x[1]=x[0]
        x[0]=dif
    return x[0]
for i in sys.stdin:
    ary.append(list(map(int,i.split())))
    ans.append([gcd(*ary[-1]),int(ary[-1][0]*ary[-1][1]/gcd(*ary[-1]))])
for i in range(len(ans)):
    print('{0:d} {1:d}'.format(*ans[i]))

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: import sys
for line in sys.stdin:
    a, b = map(int, line.split())
    n = a*b
    while b:
        a, b = b, a%b
    print(a, n//a)

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 sys


def g(inta, intb):
    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: import math
import sys

while True:
	try:
		a,b = map(int, input().split())
		x = math.gcd(a,b)
		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 get_gcd(_a, _b):
    if _a % _b == 0:
        return _b
    return get_gcd(_b, _a % _b)


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

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

Python: import math

lst = []
for i in range(200):
    try:
        lst.append(input())
    except EOFError:
        break

nums = [list(map(int, elem.split(' '))) for elem in lst]

# gcd 
res_gcd = [math.gcd(num[0], num[1]) for num in nums]

# lcm
res_lcm = [nums[i][0] * nums[i][1] // res_gcd[i] for i in range(len(nums))]

for (a, b) in zip(res_gcd, res_lcm):
    print('{} {}'.format(a, b))

Python: def main():
    while 1:
        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 1:
    try:
        a,b=map(int,input().split())
        c=fractions.gcd(a,b)
        print(c,(a*b)//c)
    except:break

Python: def gcd(aa, bb):
    if aa % bb == 0:
        return bb
    return gcd(bb, aa % bb)

import sys
for line in sys.stdin.readlines():
    ab = list(map(int, line.split()))
    a = max(ab)
    b = min(ab)
    g = gcd(a, b)

    print(g, a * b // g)

Python: # 最大公約数：ユークリッドの互除法
import sys

def gcd(x, y):
    return y if not x%y else gcd(y, x%y)

def get_input():
    data = []
    for line in sys.stdin:
        a, b = [int(i) for i in line.split()]
        data.append((a,b))
    return data


data = get_input()

for x,y in data:
    GCD = gcd(x,y)
    LCM = x*y // GCD
    print(GCD, LCM)

Python: import sys
  
def gcd(m,n):
    return m if n==0 else gcd(n, m%n)

for m,n in [map(int,x.split()) for x in list(sys.stdin)]:
    g = gcd(m,n)
    print(g,(m//g)*n)

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 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: import fileinput
import math
for line in fileinput.input():
    a, b = map(int, line.split())
    gcd = math.gcd(a, b)
    lcm = a * b // gcd
    print(gcd, lcm)