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: Wrong Answer)

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;
                int small = num_array[0];
                int big = num_array[1];
                while (true)
                {
                    int ans = big % small;
                    if (ans == 0)
                    {
                        max = small;
                        break;
                    }
                    else
                    {
                        big = small;
                        small = ans;
                    }

                }
                int min = num_array[0] * num_array[1] / max;

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