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: 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.readlines():
    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: import sys
def gcd(a, b):
    for i in range(1, a+1):
        if a % i == 0:
            t = a // i
            if b % t == 0:
                return t
for line in sys.stdin:
    a, b = sorted(map(int, line.split()))
    gcdab = gcd(a, b)
    print(gcdab, a // gcdab * b)

Python: import sys

def gcd(x, y):
    if x % y != 0:
        return gcd(y, x % y)
    return y

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

Python: import sys
import math
def main():
    for line in sys.stdin:
        a,b = map(int, line.split())
        o1 = math.gcd(a, b)
        o2 = int(a * b / o1)
        print(o1, o2)


if __name__ == "__main__":
    main()

Python: import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


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

Python: # coding=utf-8


def solve_gcd(number1: int, number2: int) -> int:
    two_list = [number1, number2]
    two_list.sort()
    if two_list[1] % two_list[0] == 0:
        return two_list[0]
    r = two_list[1] % two_list[0]
    return solve_gcd(two_list[0], r)


def solve_lcm(number1: int, number2: int, number3: int) -> int:
    return number1*number2//number3


if __name__ == '__main__':
    while True:
        try:
            a, b = map(int, input().split())
        except EOFError:
            break
        gcd = solve_gcd(a, b)
        lcm = solve_lcm(a, b, gcd)
        print(gcd, lcm)

Python: # -*- coding: utf-8 -*-

import sys
import os

def gcd(a, b):
    # big - small
    while a != b:
        if a > b:
            a, b = b, a
        a, b = b - a, a
    return a

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

lst = sys.stdin.readlines()
for s in lst:
    a, b = map(int, s.split())
    G = gcd(a, b)
    L = lcm(a, b)
    print(G, L)

Python: import sys
def main():
    tmp = sys.stdin.readline()
    while tmp:
        tmp = sys.stdin.readline().split("")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        

        tmp = sys.stdin.readline()

        
if __name__ == "__main__":
    main()

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), int((a * b) / gcd(a, b))))

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: a, b = map(int, input().split())
d = a * b
if a < b:
    tmp = a
    a = b
    b = tmp

c = a % b
while(c != 0):
    a = b
    b = c
    c = a % b

g = b
l = d / g

print(str(g)+" "+str(l))

Python: #!/usr/bin/env python3

while(True):
	try:
		a,b=map(int, input().split())
	except EOFError:
		break

	#euclidian algorithm	
	r=a%b
	x,y=a,b
	while(r>0):
		x=y
		y=r
		r=x%y
	gcd=y
	lcm=int(a*b/gcd)
	print("{0} {1}".format(gcd, lcm))

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

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 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: 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(a, b):
    if (a % b) == 0:
        return b
    return gcd(b, a%b)

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


while True:
    try:
        nums = list(map(int, input().split()))
        print(gcd(nums[0], nums[1]), lcd(nums[0], nums[1]))

    except EOFError:
        break

Python: import sys

def euc(n,m):
    if n == m:
        return m
    elif m == 1 | n == 1:
        return 1
    else:
        return euc(min(n,m), max(n,m)-min(n,m))

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

Python: import math
while True:
    try:
        x, y = map(int, input().split())
        print(str(math.gcd(x,y)) + " " + str((x * y) // math.gcd(x, y)))
    except EOFError:
        break

Python: import sys

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

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

for line in sys.stdin:
	a,b = map(int, line.split())
	print("{} {}".format(gcd(a,b),lcm(a,b)))

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: def gcd(li):
    a=max(li)
    b=min(li)
    while b>0:
        a,b=b,a%b
    return a

def lcm(li):
    return li[0]*li[1]/gcd(li)

while True:
    try:
        li=[int(i) for i in input().split(" ")]
        print("%i %i"%(gcd(li),lcm(li)))
    except:break

Python: # Aizu - 0005
def De(a):
    res = []
    tmp = 2
    while a != 1:
        while not (a % tmp):
            a = round(a / tmp)
            res.append(tmp)
        tmp += 1
    return res

while True:
    try:
        tmp = input()
        a = [int(i) for i in tmp.split(' ')]
    except:
        break
    b = De(a[1])
    a = De(a[0])
    pa, pb = 0, 0
    GCD, LCM = 1, 1
    while True:
        if pa == len(a):
            for i in range(pb, len(b)):
                LCM *= b[i]
            break;
        if pb == len(b):
            for i in range(pa, len(a)):
                LCM *= a[i]
            break;
        if a[pa] == b[pb]:
            GCD *= a[pa]
            LCM *= a[pa]
            pa += 1
            pb += 1
            continue
        if a[pa] < b[pb]:
            LCM *= a[pa]
            pa += 1
            continue
        if a[pa] > b[pb]:
            LCM *= b[pb]
            pb += 1
            continue
    print('%d %d'%(GCD, LCM))

Python: import sys


def g(a,b):
    return g(abs(a-b),a) if a%abs(a-b)!=0 else abs(a-b)
sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, a*b//c)

Python: import sys

for s in sys.stdin:
    a = list(map(int, s.split()))
    b = a[0]
    c = a[1]

    while c != 0:
        b, c = c, b%c

    d = a[0] * a[1] / b
    print(int(b), int(d))