Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

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

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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)

Python: def GCD(x, y):
  # 最大公約数
    if x < y:
        x, y = y, x
    while True:
        r = x % y
        if r == 0:
            return y
        x, y = y, r


def calc_DCD_LCM(x, y):
  # 最大公約数
    gcd = GCD(x, y)
  # 最小公倍数
    lcm = int(x*y/gcd)
    return(gcd, lcm)


while True:
    try:
        x, y = list(map(int, input().split()))
        gcd, lcm = calc_DCD_LCM(x, y)
        print('{0} {1}'.format(gcd, lcm))
    except:
        exit(0)

Python: import sys
def main():
    a = sys.stdin.readline()
    print ("Hello World")
 
if __name__ == "__main__":
    main()

Python: import sys
import fractions

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

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