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

while 1:
    a, b = map(int,input().split())
    g = gcd(a, b)
    l = a / g * b
    print(g, l)

Python: t = 0
while t == 0:	
	try:
		x,y=[int(i) for i in input().split()]
	except:
		break
	else:
		a = x * y
		if x < y:
			x,y =y,x
		while y > 0:
			r = x % y
			x = y
			y = r
	print(str(x) + " " + str(int(a / x)))

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

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

if __name__ == "__main__":
    while True:
        try:
            a, b = map(int, input().split())
            g = gcd(a, b)
            l = lcm(a, b)
            print("{} {}".format(g, l))
        except:
            break

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


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


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

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

Python: #!/usr/bin/env python3
import sys
from fractions import gcd

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

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

while True:
    try:
        x,y=map(int,input().split())
    except:
        break
    print(gcd(x,y),x*y//gcd(x,y))

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

        

        tmp = sys.stdin.readline()
        break

        
if __name__ == "__main__":
    main()

Python: import sys

def get_gcd(a, b):
    if a < b:
        a, b = b, a

    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)

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

def main():
    while True:
        data = sys.stdin.readline().strip()
        if data is None or data == '':
            break

        nums = data.split(' ')
        a = int(nums[0])
        b = int(nums[1])
        gcd = get_gcd(a, b)
        lcm = get_lcm(a, b, gcd)
        print(gcd, lcm)
        
        
if __name__ == '__main__':
    main()

Python: while True:
        try:
            list = [int(x) for x in raw_input().split(" ")]
            list.sort(lambda x, y: y - x)
            gcd = lcm = 0
            m = list[0]
            n = list[1]
            while True:
                r = m%n
                if r == 0:
                    gcd = n
                    break
                m = n
                n = r
            num = list[0]
            while True:
                if num%list[0] == num%list[1] == 0:
                    lcm = num
                    break
                num += gcd
            print(str(gcd) + " " + str(lcm))
        except EOFError:
            break

Python: while 1:
    try:
        x,y=[int(i) for i in input().split()]
        a=x
        b=y

        while 1:
            c=x%y
            if x%y==0:
                print(y,a*b//y)
                break
            else:
                x=y
                y=c
    except EOFError:
        break

Python: # coding: utf-8
# Here your code !

import sys

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

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

Python: def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(len(N)):
    a,b = [int(i) for i in N[l].split()]
    A = a
    B = b
    if(a<b):
        c = a
        a = b
        b = c

    while b > 0:
        nexta = b
        nextb = a % b
        a = nexta
        b = nextb

    g = a
    print(g, int(A*B/g))

Python: import math
import sys

for line in sys.stdin.readlines():
    a, b = map(int, line.split())
    print(a, b)
# 最小公倍数
def lcm(a, b):
    return (a*b) // math.gcd(a ,b)
# 出力　
print("{} {}".format(math.gcd(a, b), lcm(a, b)))

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 == 0 or b == 1):
            break
    return int(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(max(line), min(line))
        print(str(g) + " " + str(line[0]*line[1]/g))  # + str(lcm(line[0], line[1]))
    except:
        raise
        exit()

Python: from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
import sys

for line in sys.stdin:
    small, large = sorted(int(n) for n in line .split())
    for i in xrange(small, 0, -1):
        if large % i == 0 and small % i == 0:
            gcd = i
            break
    for i in xrange(2, large + 1):
        if i * small % large == 0:
            lcm = i * small
            break
    print(gcd, lcm)

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: from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
import sys
from fractions import gcd
from itertools import count

for line in sys.stdin:
    small, large = sorted(int(n) for n in line .split())
    for i in count(large, large):
        if not i % small:
            lcm = i
            break
    print(gcd(large, small), lcm)