Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			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: 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)

Python: import sys
for line in sys.stdin:
    a,b = map(int, line.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: def gcd(m, n):
    while n:
        m, n = n, m % n
    return m
def lcm(m, n):
    return m // gcd(m, n) * n

for line in open(0).readlines():
    a, b = map(int, line.split())
    print(gcd(a, b), lcm(a, b))

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

Python: #!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

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

def main():
    for line in sys.stdin:
        a, b = map(int, line.split())
        d = gcd(a, b)
        m = a * b // d
        print("{} {}".format(d, m))

if __name__ == "__main__": main()

Python: import sys
for i in sys.stdin:
	m, n = map(int, i.split())
	t1, t2 = m, n
	while True:
		if m % n == 0:
			break
		m, n = n, m % n
	a = n
	b = (t1/ a) * t2
	print("{} {}".format(a, b))

Python: def gcd(a,b):
    if a > b:
        x = a
        y = b
    else:
        x = b
        y = a
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

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

while 1:
    try:
        a,b = [int(x) for x in input().split()]
        gcd = gcd(a,b)
        lcm = lcm(a,b,gcd)
        print('{} {}'.format(gcd,lcm))
    except:
        break

Python: 
import math

while 1:
    try:
        a, b = map(int, input().split())

        print(math.gcd(a,b), a * b // math.gcd(a,b))
    except:
        break

Python: def gcd(n, m):
    while n!=0:
        tmp = n
        n = m % n
        m = tmp
    return m

while 1:
    try:
        n, m = map(int, input().split())
        x = gcd(n, m)
        print(x, int(n*m/x))
    except EOFError:
        break

Python: import sys

def dividend(num, Q):
    a = Q
    b = (num / Q) * Q
    Q = num - (num / Q) * Q
    if num  == b:
        return aaa(a)
    dividend(num, 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: ans=[]
while True:
    try:
        mins=0
        maxs=0
        nums=input().split()
        nums[0]=int(nums[0])
        nums[1]=int(nums[1])
        nums_copy=nums.copy()
        while True:
            if nums[0]%nums[1]==0:
                 maxs=nums[1]
                 break
            num=nums[1]
            nums[1]=nums[0]%nums[1]
            nums[0]=num
        mins=nums_copy[0]*nums_copy[1]/maxs
        ans.append(maxs)
        ans.append(mins)
    except:
        break

for i in range(len(ans)/2):
    print(ans[i*2],ans[i*2+1])

Python: import sys

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

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

Python: # This program computes GCD and LCM
# -*- coding: utf-8
import sys


def gcd(a, b):
    while True:
        tmpb = b
        b = a % b
        a = tmpb
        if(b == 1):
            break
    return a


def lcm(a, b):
    for i in range(max([a, b]), a*b + 1):
        if(i % a == 0 and i % b == 0):
            return i
    return a*b


for i in sys.stdin:
    try:
        line = [int(k) for k in i.split(" ")]
        g = gcd(line[0], line[1])
        print(str(g) + " " + str(line[0]*line[1]//g))  # + str(lcm(line[0], line[1]))
    except:
        raise
        exit()

Python: import math
import sys
for line in sys.stdin.readlines():
    a, b = list(map(int, line.split()))
    print(f'{math.gcd(a,b)} {a*b//math.gcd(a,b)}')

Python: from sys import stdin
import math

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

def LCM(a,b):
    gcd = GCD(a,b)
    return a*b/gcd

for line in stdin:
    a,b = line.split(" ")
    a = int(a)
    b = int(b)
    gcd = GCD(a,b)
    lcm = math.floor(LCM(a,b))

    print(str(gcd)+" "+str(lcm))
    print()

Python: import sys
def gcd(a,b):
    if a<b:
        t = a
        a = b
        b = t
    while b != 0:
        temp = b
        b = a%b
        a = temp
    return a

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