Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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 euc(n,m):
    if n == m:
        return m
    elif m == 1 or 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 sys
  
for s in sys.stdin:
    g,r=m,n = map(int,s.split())
    while r!=0:
      g,r = r,g%r
    print(g,m//g*n)

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

Python: import sys
a=[map(int,i.split())for i in sys.stdin]
for i,j in a:
	c,d=i,j
	while d:
		if c>d:c,d=d,c
		d%=c
	print(c,i//c*j)

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: import sys

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    return int(a*b / gcd(a,b))

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

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

Python: import sys 
for e in sys.stdin:
    a, b = map(int, e.split())
    p = a * b
    while b:
        a, b = b, a%b
        pass
    print (str(a)+' '+str(p/a))

Python: import math, sys
def lcm(a,b):
    return int(a*b/math.gcd(a,b))

if __name__ == '__main__':
    for line in sys.stdin:
        a,b = map(int,line.split())
        print(int(math.gcd(a,b)),lcm(a,b))

Python: while True:
  try:
    a,b=map(int,input().split())
    if a<b:
      a,b=b,a
    s=b
    r=a%s
    while True:
      if r==0:
        G=s
        break
      else:
        s,r=r,s%r
    L=int((a*b)/G)
    print(G,L)
  except EOFError:
    break

Python: while True:
    try: 
        a, b = map(int, input().split())
        cross = a * b

        if a < b:
            a, b = b, a
        while a % b != 0:
            a, b = b, a % b
        print(b, cross // b)
    except EOFError:
        break

Python: while 1:
    try:
        a = list(map(int, input().split()))
        b=list(a)
        a.sort()
        while a[1]%a[0] != 0:
            a[1] %= a[0]
            a.sort()
        print(a[0], int(b[0]*b[1]/a[0]))
    except:
        break

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