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: Time Limit Exceeded)

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

namespace contest5
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                //空白で分割する
                var line_origin = Console.ReadLine();

                if (string.IsNullOrEmpty(line_origin))
                {
                    break;
                }
                var line = line_origin.Split();
                //配列の要素、すべてに処理を行う
                var num_array = Array.ConvertAll(line, len => int.Parse(len));

                Array.Sort(num_array);

                //最大公約数
                int max = 0;
                for (int i = 1; i < num_array[1]; i++)
                {
                    if (num_array[0] % i == 0)
                    {
                       if( num_array[1] % i == 0)
                        {
                            max = i;
                        }
                    }
                }

                //最小公倍数
                int min = 0;
                for (int i = num_array[1]; i < 2000000; i++)
                {
                    if (i % num_array[0] == 0)
                    {
                        if (i % num_array[1] == 0)
                        {
                            min = i;
                            break;
                        }
                    }
                }

                Console.WriteLine("{0} {1}", max.ToString(), min.ToString());
            }
        }
    }
}