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

Python: class GCD():
    def __init__(self,a,b):
        self.a = a
        self.b = b

    def swap(self):
        temp = self.a
        self.a = self.b
        self.b = temp

    def gcd(self):
        if self.b < self.a:
            self.swap()

        temp = self.b % self.a

        if temp == 0:
            ans = self.a
            return ans

        ans = self.b % temp

        return ans

    def lcm(self):
        gcd = self.gcd()
        temp = self.a * self.b
        ans = temp // gcd
        return gcd,ans

    def print(self):
        num = self.lcm()
        print("{0} {1}".format(num[0],num[1]))

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: import fractions as f
while 1:    
    a,b=map(int,input().split())
    print(str(f.gcd(a,b))+' '+str(a*b//f.gcd(a,b)))

Python: import fractions as f
a,b=map(float,input().split())
print(f.gcd(a,b))
print(a*b//f.gcd(a,b))

Python: import math
import sys

for line in sys.stdin.readlines():
#for line in data.split('\n'):
	x,y = [int(s) for s in line.split(' ')]
	G = math.gcd(x,y)
	L = int(x*y/G)
	print(G,L)

Python: #GCD and LCM

while True:
    try:
        a, b = (int(i) for i in input(). split())
        x = a * b
        while True:
            c = a % b
            a = b
            b = c
            if a % b == 0:
                break
        x = x / a
        print("%d %d" % (b, x))
    except:
        break

Python: import sys
list = sys.stdin.readlines()

e=0
GCD = 0
def Euclide(a, b):
    if b == 0:
        return a
    if a < b:
        tmp = a
        a = b
        b = tmp
    e = a%b
    return Euclide(b, e)
    
def LCM(a, b, c):
    return int(a/c*b)

for i in list:
    a = i[0]
    b = i[1]
    GCD = Euclide(a, b)
    print(str(GCD)+" "+str(LCM(a, b, GCD)))

Python: import math
import sys

while True:
    try:
        a, b = map(int, input().split())
    except EOFError:
        break
# 最小公倍数
def lcm(a, b):
    return (a*b) // math.gcd(a ,b)
# 出力　
print("{} {}".format(math.gcd(a, b), lcm(a, b)))

Python: import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
if __name__ == '__main__':
    while True:
        try:
            a, b = map(int, input().split())
            print('{0} {1}'.format(math.gcd(a, b), lcm(a, b)))
        except EOFError:
            break

Python: import sys
dataset = sys.stdin.readlines()
 
 
def gcd(a, b):
    if b > a: return gcd(b, a)
    if a % b == 0: return b
    return gcd(b, a % b)
 
def lcd(a, b):
    return a * b // gcd(a, b)
 
for item in dataset:
    a, b = list(map(int, item.split()))
    print(gcd(a, b), lcd(a,b))