Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #include<iostream>

bool listen_numbers(int &,int &);

class Nums
{
private:
	int a,b;//a>=b
	int gcd;
	int lcm;
	
	void calc_gcd();
	void calc_lcm();
public:
	Nums(int,int);
	void echo_gcd();
	void echo_lcm();
};

Nums::Nums(int x,int y)
{
	if(x>=y)
	{
		this->a=x;
		this->b=y;
	}
	else
	{
		this->a=y;
		this->b=x;
	}
	
	this->gcd=0;
	this->lcm=0;
	
}

void Nums::calc_gcd()
{
	int rest1=this->a;
	int rest2=this->b;
	
	int tmp;
	while(rest1!=0 && rest2!=0)
	{
		tmp=rest1%rest2;
		rest1=rest2;
		rest2=tmp;
	}
	this->gcd=rest1;
}

void Nums::calc_lcm()
{
	if(this->gcd==0)
	{
		this->calc_gcd();
	}
	
	this->lcm=(int)((double)this->a*this->b/this->gcd);
}

void Nums::echo_gcd()
{
	if(this->gcd==0)
	{
		this->calc_gcd();
	}
	std::cout<<this->gcd;
}

void Nums::echo_lcm()
{
	if(this->lcm==0)
	{
		this->calc_lcm();
	}
	std::cout<<this->lcm;
}

int main()
{
	int a,b;
	
	for(;listen_numbers(a,b);)
	{
		Nums num=Nums(a,b);
		
		num.echo_gcd();
		std::cout<<" ";
		
		num.echo_lcm();
		std::cout<<std::endl;
	}
	
	return 0;
}

bool listen_numbers(int &a,int &b)
{
	using namespace std;
	
	cin>>a>>b;
	
	if(cin.eof())
	{
		return false;
	}
	else
	{
		return true;
	}
}

C++: 
#include <string>
#include <iostream>
#include <sstream>

long __gcd(long a, long b)
{
//    std::cout << "in __gcd\n";
//    std::cout << "a: " << a << "\nb: " << b << '\n';
    if (b % a == 0) {
//        std::cout << "returning " << a << '\n';
        return a;
    } else {
        return __gcd(b % a ,a);
    }
}

long gcd(long a, long b)
{
    if (a > b)
        return __gcd(b, a);
    return __gcd(a, b);
}

long lcm(long a, long b)
{
    return a * b / gcd(a, b);
}

int main(void)
{
    int a, b;
    std::string str;

    while (getline(std::cin, str)) {
        std::istringstream str_s(str);
        str_s >> a >> b;

        std::cout << gcd(a, b) << ' ' << lcm(a, b) << '\n';
    }
    
    return 0;
}

C++: #include<iostream>
#include<algorithm>

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[4];

	tmp[0] = std::max( a, b );
	tmp[1] = std::mix( a, b );

	for( n = 0;; n++ ){
		for( i = 1;(tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i ) >= tmp[( n + 1 ) % 3]; i++ ){
			if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
		if( n > 2000000000 ){
			return -1;
		}
	}

	return -1;
}

C++: #include <iostream>
using namespace std;

int main(){
  long a, b;
  long ca, cb, tmp;
  long gcd, lcm;

  while(cin >> a){
    cin >> b;
    ca=a; cb=b;

    if(ca<cb){
      tmp=ca; ca=cb; cb=tmp;
    }

    while(cb!=0){
      ca%=cb;
      if(ca==0){
        ca=cb;
        break;
      }
      cb%=ca;
    }
    gcd=ca;
    lcm=a*b/gcd;

    printf("%ld %ld\n", gcd, lcm);
  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>

using namespace std;

typedef pair<int, int> P;

int gcd(int a, int b) {
	if (a == 0) return b;
	if (b == 0) return a;

	return gcd(b, a % b);
}

P lcm(int a, int b) {
	int g = gcd(a, b);

	return P(g, a / g * b);
}

int main() {
	char s[1000];
	while (1) {
		string str;
		if ( !getline(cin, str) ) break;

		for (int i = 0; i < str.size(); ++i)
			s[i] = str[i];
		s[str.size()] = '\0';

		int a, b;
		sscanf(s, "%d%d", &a, &b);

		P p = lcm(a, b);

		cout << p.first << " " << p.second << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>

using namespace std;

unsigned long long gcd( unsigned long long a, unsigned long long b)
{
	if( b == 0 ) return a;
	else return gcd( b, a % b );
}
int main(int argc, char const* argv[])
{
	unsigned long long a,b,c;

	while( cin >> a >> b ){
		c = gcd(a,b);
		a /= c;
		a *= b;
		cout << c << " " << a << endl;
	}
	return 0;
}

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<2;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <iostream>

auto gcd (unsigned a , unsigned b) -> unsigned
{
    return b ? gcd (b , a % b) : a;
}

auto lcm (unsigned a , unsigned b) -> unsigned
{
    return a / gcd (a , b) * b;
}

auto main () -> int
{
    unsigned int a , b;
    while (std::cin >> a >> b)
    {
        std::cout << gcd (a , b) << ' ' << lcm (a , b) << std::endl;
    }
}

C++: #include<stdio.h>
int main(){
  unsigned long long a,b,m,ca,cb;
  while(scanf("%d %d",&a,&b)!=EOF){
    m = a%b;
    ca = a;
    cb = b;
    while(m){
      a = b;
      b = m;
      m = a%b;
    }
    ca /= b;
    printf("%d %d\n",b,ca*cb);
  }
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

while((r=b%a)!=0){
   q=b/a;
   b=a;
   a=r;
   
   return a;
}

int main(void)
{    int a, b;
    while(cin >> a >> b) {
      int lcm = a/gcd(a,b)*b;
      cout << gcd(a,b) << " " << lcm << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	return 0;
}

C++: #include<iostream>
#include<fstream>
using namespace std;


unsigned long long int GCM(unsigned long long int a,unsigned long long int b){
	while(a!=b){
		a>b? a-=b:b-=a;
	}
	return a;
}

int main()
{
	unsigned long long int a,b,L,G;
	
	cin>>a;
	do{
	cin>>b;
	if(a!=0&&b!=0){
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}
	}while(cin>>a);
	cin>>a;
}

C++: #include<iostream>
using namespace std;

int gcd(int a,int b){
	if(b==0) return a;
	
	return gcd(b,a%d);
}

int main(){
	
	while(true){
		int a,b;
		cin >> a >> b;
		
		if(cin.eof()) break;
		
		int g = gcd(a,b);
		cout << g << ' ' << a/g*b << endl;
		
	}
	
	return 0;
	
}

C++: #include <iostream>
using namespace std;

int gcd(int a, int b){
	if(b==0)
		return a;

	return gcd(b,a%b);
}

int main(){
	while(true){
		int a,b;
		cin >> a>> b;
		
		if(cin.eof())
			break;

		int g=gcd(a,b);
		cout << g <<' '<<a/g*b <<endl;
	}
	
	return 0;
}

C++: //
//  main.c
//  c
//
//  Created by ????????? on 2016/12/10.
//  Copyright ?? 2016??´ ?????????. All rights reserved.
//

#include <stdio.h>
#include "0005.h"
int main(){
    long long a, b, r, lcm, x, y;
    while (scanf("%lld %lld",&a,&b) != EOF) {
        x=a;
        y=b;
        for (;;) {
            r=x%y;
            if (r==0)
                break;
            x=y;
            y=r;
        }
        lcm=a*b/y;
        printf("%lld %lld\n",y,lcm);
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b,c,d;
    while (1){
        cin >> a >> b;
        if(cin.eof()){break;}
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

int gcd(int a,int b){
    int n;
    if (a>b){
        n=b;
        b=a;
        a=n;
    }
    while(b%a!=0){
        n=b%a;
        b=a;
        a=n;
    }
    return n;
}

int lcm(int a,int b){
    int n = a/gcd(a,b)*b;
    return n;
}

C++: # -*- coding: utf-8 -*-
import sys

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

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

for s in sys.stdin:
    a,b = map(int,s.split())
    a,b = max(a,b),min(a,b)
    print gcd(a,b),lcm(a,b)