Problem:
GCD and LCM Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b . Input Input consists of several data sets. Each data set contains a and b separated by a single space in a line. The input terminates with EOF. Constraints  0 < a, b ≤ 2,000,000,000  LCM( a, b ) ≤ 2,000,000,000  The number of data sets ≤ 50  Output For each data set, print GCD and LCM separated by a single space in a line. Sample Input 8 6
50000000 30000000 Output for the Sample Input 2 24
10000000 150000000

Solution (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

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

Solution (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

Solution (Python):
import sys;import math;print("\n".join(["{} {}".format(math.gcd(a,b), a // math.gcd(a,b) * b) for x in sys.stdin for a, b in [[int(y) for y in x.split()]] ]))

Solution (Python):
import math

while True:
    try:
        a, b = [int(x) for x in input().split()]
        print(math.gcd(a,b), a*b // math.gcd(a,b))
    except EOFError:
        break

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

Solution (Python):
import math

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

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

Solution (Python):
while True:
  try:
    ( a, b ) = map ( int, input ( ).split ( ) )
  except EOFError: break
  ( x, y ) = ( a, b )
  while x != 0:
    ( x, y ) = ( y % x, x )
  print ( "%s %s" % ( y, a * b // y ) )

Solution (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

Solution (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

Solution (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

Solution (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

Solution (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

Solution (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

Solution (Python):
while(True):
    try:
        (a, b) = map(int, input().split(" "))
        (x, y) = (a, b)
        while (x != 0):
            (x, y) = (y%x, x)
        print("%s %s" %(y, a*b//y))
    except:
        break

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

Solution (Python):
import fractions
while 1:
    try:
        a,b=map(int,input().split())
        c=fractions.gcd(a,b)
        print(c,(a*b)//c)
    except:break

Solution (Python):
import fractions
while 1:
    try:
        a,b=map(int,input().split())
        c=fractions.gcd(a,b)
        print(c,(a*b)//c)
    except:break

Solution (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

Solution (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

Solution (Python):
import math

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

Solution (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

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

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

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

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

Solution (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

Solution (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)}')

Solution (Python):
import math
import sys
if __name__ == '__main__':

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

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

Solution (Python):
def solve(a, b):
  if a % b == 0:
    return b
  else:
    return solve(b, a % b)
  
while True:
  try:
    a, b = map(int, input().split())
    lcm = solve(a,b)
    print(lcm, a * b // lcm)

  except:
    break

Solution (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

Solution (Python):




import sys


class math:
    
    pi = 3.14159265358979323846264338

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

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

math = math()


class output:
    
    def list(self, l):
        l = list(l)
        print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()















for line in sys.stdin.readlines():
    x, y = [int(temp) for temp in line.split()]
    print("{} {}".format(math.gcd(x,y), math.lcm(x,y)))

Solution (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

Solution (Python):
import sys

def euclid(x, y):
	if y == 0: return x
	elif x < y: return euclid(y, x)
	else: return euclid(y, x%y)

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

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

Solution (Python):
import math

while True:
	try:
		a,b=list(map(int,input().split()))
		x=math.gcd(a,b)
		y=int(a*b/x)
		print("%d %d"%(x,y))
	except:
		break

Solution (Python):
while True:
  try:
    m,n = map(int, input().split())
  except EOFError:
    break
  LCM = m * n
  if m < n:
    m,n = n,m

  
  while True:
    if m % n == 0:
      GCD = n
      break
    else:
      m, n = n, m % n

  
  LCM = LCM // GCD

  print(GCD,LCM)

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

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

Solution (Python):
def GCD(a,b):
    S=[a,b]
    S.sort(reverse=True)
    while S[1]>0:
        S2=[S[1],S[0]%S[1]]
        S=S2
    return S[0]
    
try:
    while True:
        a,b=[int(i) for i in input().split(" ")]
        G=GCD(a,b)
        L=int(a*b/G)
        print("%d %d"%(G,L))
except EOFError:
    pass

Solution (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

Solution (Python):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
if __name__ == '__main__':
    while True:
        try:
            a, b = map(int, input().split())
            print('{0} {1}'.format(math.gcd(a, b), lcm(a, b)))
        except EOFError:
            break

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


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


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

Solution (Python):
while True:
	try:
		n=list(map(int, input().split()))
	except EOFError:
		break
	if n[0]>n[1]:
		l=n[0]
		s=n[1]
	else:
		l=n[1]
		s=n[0]
	a=l
	b=s
	r=a%b
	while r!=0:
		a=b
		b=r
		r=a%b
	GCD=int(b)
	LCM=int(l*s/b)
	print(GCD, LCM)

Solution (Python):
def GCD(a, b):
	while b!=0:
		tmp=b
		b=a%b
		a=tmp
	return a
while True:
	try:
		a, b = map(int, input().split())
	except EOFError:
		break
	a, b = (a, b) if a>=b else (b, a)
	gcd=GCD(a,b)
	print(gcd, a*b//gcd)

Solution (Python):
import sys

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

if __name__ == "__main__":
  for line in sys.stdin:
    a, b = [int(i) for i in line.strip().split(" ")]
    GCD = findGCD(a,b)
    LCM = a*b//GCD
    print(GCD, LCM)

Solution (Python):
import sys
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
for line in sys.stdin:
    a, b = [int(x) for x in line.split()]
    c = math.gcd(a, b)
    d = lcm(a, b)
    print("%d %d" % (c, d) )

Solution (Python):
while True:
    try:
        a, b = [int(x) for x in input().split()]
        n, m = [min(a, b), max(a, b)]
        while n != 0:
            n, m = m % n, n
        print(m, a * b // m)
    except EOFError:
        break

Solution (Python):
while(1):
    try:
        a, b = map(int, input().split())
    except:
        break

    x = max(a, b)
    y = min(a, b)
    if x % y == 0:
        gcd = y
    else:
        while x % y != 0:
            z = x % y
            x = y
            y = z
        else:
            gcd = z

    lcm = a * b // gcd

    print(gcd, lcm)

Solution (Python):
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return min(x,y)
    return round(gcd(min(x,y),q))

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

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

Solution (Python):
import math

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

while True:
    try:
        a, b = map(int, input().split())
        print('{} {}'.format(math.gcd(a, b), lcm(a, b)))
    except:
        break

Solution (Python):
while True:
    try:
        a,b = map(int, input().split())
        nlist = sorted([a,b])
        while True:
            c = nlist[1]%nlist[0]
            nlist = [c, nlist[0]]
            if (c == 0):
                break
        ss = nlist[1]
        print(ss, int(a*b/ss))
    
    except EOFError:
        break

Solution (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

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

Solution (Python):

import sys


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


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

for s in sys.stdin:
  a, b = map(int,s.split())
  gcd_num = gcd(a, b)
  lcm_num = lcm(a, b)
  print "%d %d"%(gcd_num, lcm_num)

Solution (Python):
ans = []

def gcd(a, b) :
    if a % b == 0 :
        return b
    else :
        return gcd(b, a % b)
        
def lcm(a, b) :
    return a * b // gcd(a, b)

while True :
    try :
        s = input()
        a, b = map(int, s.split())  
        m_gcd, m_lcm = gcd(a, b), lcm(a, b)
        ans.append([m_gcd, m_lcm])
    except :
        for a in ans :
            print(a[0], a[1])
        break

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


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

if __name__ == '__main__':
    run()

Solution (Python):
from fractions import gcd

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

Solution (Python):
import sys,math
for e in sys.stdin:
 a,b=map(int, e.split())
 d=a*b
 a = math.gcd(a,b)
 print(a, d//a)

Solution (Python):
def gcd(a, b):
    if a == 0:
        return b
    else:
        return gcd(b%a, a)
def lcm(a, b):
    return a*b//gcd(a, b)
while 1:
    try:
        a,b = map(int, input().split(" "))
        print(gcd(a, b),lcm(a, b))
    except:
        break

Solution (Python):
def gcd(a,b):
	if b < 1: return a
	a,b = b,a % b
	return gcd(a,b)
ss = input().split()
while ss:
	a,b = map(int,ss)
	g = gcd(a,b)
	l = int(a*b/g)
	print(g,l)
	try: ss = input().split()
	except EOFError: break

Solution (Python):
while True:
	try:
		data = map(int, raw_input().split())
		[a, b] = data
		m = a
		n = b
		
		while m % n != 0:
			hoge = m % n
			m = n
			n = hoge

		gcm = n
		lcm = a * b / gcm

		print gcm, lcm
	
	except EOFError:
		break