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 in C# (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

    
    
    class Program
    {
        //GCD(最大公約数)
        static long GCD(long big, long smoll)
        {
            if(big < smoll)
            {
                long tmp = big;
                big = smoll;
                smoll = tmp;
            }

            while(smoll > 0)
            {
                long amari = big % smoll;
                big = smoll;
                smoll = amari;
            }

            return big;
        }

        //最大公約数(LCM)
        static long LCM(long a, long b)
        {
            return (long)a / GCD(a, b) * b;
        }


        static void Main(string[] args)
        {
            while (true)
            {
                string str = Console.ReadLine();
                if (str == null) break;
                string[] input = str.Split(' ');               
                long a = int.Parse(input[0]);
                long b = int.Parse(input[1]);

                Console.WriteLine($"{GCD(a, b)} {LCM(a, b)}");
                
            }
            
        }
    }
}