Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts()(a, b int){
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

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

Python: import sys


def gcd(m, n):
  if n > m:
    m, n = n, m
  if n == 0:
    return m
  else:
    return gcd(n, m % n)


for line in sys.stdin:
  try:
    a, b = [int(i) for i in line.split()]
    g = gcd(a, b)
    l = a * b / g
    print("%d %d" % (g, l))
  except:
    break

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

def lcm(x, y):
    return x//gcd(x, y)*y

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

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

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

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

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

Python: import sys

#最大公約数
def gcd(x, y):
    s = x / y
    r = x % y
    if r == 0:
        return y
    else:
        return gcd(y, r)

#最小公倍数
def lcm(x, y):
    return x*y/gcd(x, y)

def main():
    #print ("a")
    tmp = sys.stdin.readline().split(" ")
    #print ("b")
    while 1:
        a = long(tmp[0])
        b = long(tmp[1])
        #print ("a="+str(a))
        #print ("b="+str(b))
        #b = sys.stdin.readline()
        #print ("d")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        print (str(gcd(c, d)) + " " + str(long(lcm(c,d))))

        tmp = sys.stdin.readline()
        if len(tmp) == 1:
            break
        else:
            tmp = tmp.split(" ")

    #print ("exit")
     
if __name__ == "__main__":
    main()

Python: import math
a,b=map(int,input().split())
A,B=map(int,input().split())

def lcm(x,y):
  return (x*y)//math.gcd(a,b)

def lcm2(q,w):
  return (q*w)//math.gcd(A,B)

print(math.gcd(a,b),lcm(a,b))
print(math.gcd(A,B),lcm2(A,B))

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 (a,p/a)

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: while 1:
    try:
        a = list(map(int, input().split()))
        a.sort()
        while a[1]%a[0] != 0:
            a[1] %= a[0]
            a.sort()
        print(a[0])
    except:
        break

Python: def pd(n):
    i = 2
    ans = []
    while i ** 2 <= n:
        while n % i == 0:
            n /= i
            ans.append(i)
        i += 1
    if n > 1:
        ans.append(n)
    return ans

def gcd(a, b):
    gcd = 1
    pd_a = pd(a)
    pd_b = pd(b)
    for i in pd_a:
        if i in pd_b:
            pd_b.remove(i)
            gcd *= i
    return int(gcd)

def lcm(a, b):
    lcm = a
    pd_a = pd(a)
    pd_b = pd(b)
    for i in pd_a:
        if i in pd_b:
            pd_b.remove(i)
    for j in pd_b:
        lcm *= j
    return int(lcm)

while True:
    s = input()
    if not s:
        break
    a,b = [int(i) for i in s.split(' ')]
    print(gcd(a, b), lcm(a, b))

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

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

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

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

import sys
s = sys.stdin.readlines()
n = len(s)
for i in range(n):
    x, y = map(int, s[i].split())
    print(GCD(x, y), LCM(x, y))

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

        

        tmp = sys.stdin.readline()
        if len(tmp) == 1:
            break
        
if __name__ == "__main__":
    main()

Python: import sys
def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x%y)

def lcm(x, y):
  return x * y //gcd(x,y)
    

for line in sys.stdin:
  x, y = map(int, line.split())
  print(gcd(x, y), lcm(x,y))

Python: import sys
def GcdLCM():
    for line in sys.stdin:
        x,y=map(int,line.split())
        if x==None:
            break
        
        gcd = Gcd(x,y)
        lcm = int(x*y/gcd)

        print("{} {}".format(gcd,lcm))
       
def Gcd(x,y):
    while x!=0:
        x,y=y%x,x
    return y
        
    
GcdLCM()

Python: import sys

#最大公約数
def gcd(x, y):
    s = x / y
    r = x % y
    if r == 0:
        return y
    else:
        return gcd(y, r)

#最小公倍数
def lcm(x, y):
    return x*y/gcd(x, y)

def main():
    #print ("a")
    for line in iter(sys.stdin.readline, ""):
        print (line)
        #tmp = sys.stdin.readline().split(" ")
        #print ("b")
        tmp = line.split(" ")
    
        a = int(tmp[0])
        b = int(tmp[1])
        #print ("a="+str(a))
        #print ("b="+str(b))
        #b = sys.stdin.readline()
        #print ("d")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        print (str(gcd(c, d)) + " " + str(int(lcm(c,d))))

        #tmp = sys.stdin.readline()
        #if len(tmp) == 1:
        #    break
        #else:
        #    tmp = tmp.split(" ")

    #print ("exit")
     
if __name__ == "__main__":
    main()

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

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

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

Python: import sys

nums = []


for line in sys.stdin:
    nums.append(line)

for i in range(len(nums)):
    input_line = nums[i].split(" ")
    a = long(input_line[0])
    b = long(input_line[1])


    #??¬?´???°?????????
    common_div = []

    #?????§??¬?´???°
    if a < b:
        last_num = a
    else:
        last_num = b

    for j in range(1,last_num-1):
        if a%j == 0 and b%j == 0:
            #a???b???j??§???????????¨???
            common_div.append(j)
    
    max_common_div = common_div[len(common_div)-1]
    min_common_mpl = long((a * b)/max_common_div)

    print(str(max_common_div) + " " + str(min_common_mpl))

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


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

    except EOFError:
        break

Python: import sys
for i in sys.stdin:
    a, b = map(int, i.split())
    p, q = max(a, b), min(a, b)
    while True:
        if p % q == 0:
            break
        else:
            p, q = q, p % q
    print("{} {}".format(q, int(a * b / q)))