a = gets.chomp.to_i
b = gets.chomp.to_i

gcd = 1
for i in 1..x
  if(a%i == 0 && y%i == 0)
    gcd = i
  end
end
print gcd

lcm = a*b
for i in a..a*b
  if(i%a == 0 && i%b == 0)
    lcm = i
    break
  end
end
print lcm