Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include <iostream>

using namespace std;

int calcGcd(int x, int y)
{
    int r;

    if (x < y)
    {
        swap(x, y);
    }

    while(y > 0)
    {
        r = x % y;
        x = y;
        y = r;
    }

    return x;
}

int main( )
{
    int a, b;
    int gcd, lcm;
 
    while(cin >> a >>  b)
    {
        gcd = calcGcd(a, b);
        lcm = a / gcd * b;

        cout << gcd << " " << lcm << endl; 
    }

    return 0;
}

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

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()
{
    unsigned long long a, b;

    while( cin >> a >> b )
    {

        if( a > b && a % b == 0 )       //値が大きい場合の最大公約数を先に求めておく
        {
            cout << b << " " << a << endl;
            break;
        }
        if( b <= a && b % a == 0 )
        {
             cout << a << " " << b << endl;
            break;
        }

        for( int i = a; i > 0; i-- ) 
        {
                if( a % i == 0 && b % i == 0 ) 
                {
                    cout << i << " " << a * b / i << endl;
                    break;
                }
        }
    }
    return 0;
}

C++: #include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <algorithm>

using namespace std;

long int a,b,gcd,lcm;

int main()
{
	while(scanf("%ld %ld", &a, &b) != EOF)
	{
	for(int i=1;i<=a&&i<=b;i++)
	{
		if(a%i==0&&b%i==0)
		{
			gcd=i;
		}
	}
	lcm=max(a,b);
	do {
    if (lcm%a == 0 && lcm%b == 0) {
            break;
        }
        else
            lcm=lcm+gcd;
    }
    while (true);
    printf("%ld %ld\n",gcd,lcm);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


long long gcd(long long x,long long y){
    while(x%y!=0){
        long long tmp;
        tmp=x;
        x=y;
        y=tmp%y;
    }
    return y;
}

long long lcm(long long x,long long y){
    return x*y/gcd(x,y);
}

int main(){
    long long a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        long long g,l;
        if(a<b){
            swap(a,b);
        }
        g=gcd(a,b);
        l=lcm(a,b);
        printf("%lld %lld\n",g,l);
    }
    return 0;
}

C++: #include <iostream>
#include<cstdio>
#include<queue>
#include<cmath>
using namespace std;
int n,m;

int GCDi(int a,int b){
    int t;
    t = a%b;
    if(a%t &&  b%t ){
       return  GCDi(b,t);
    }
    else return t;
}
int LCMi(int a,int b){
    int t;
    t = GCDi(a,b);
    return a/t*b;
}
int main(){
    while(~scanf("%d%d",&n,&m)){
        int q,r;
        if(n > m){q = GCDi(n,m);r =LCMi(n,m);}
        else if(n > m){q = GCDi(m,n) ;r =LCMi(m,n);}
        else {
            q =n;r = n;
        }
        cout<<q<<" "<<r<<endl;
    }return 0;
}

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

int main() {
	int a,b,c,e,f;
	while(cin>>a>>b){
		int g=0,l=0;
		e=a;
		f=b;
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    	break;
	    }
		cout<<l<<" "<<a*b/l<<endl;
	    }
	return 0;
}

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

int Gcd(int a,int b){
    int c,d;
    if(b>a){
        d=a;
        a=b;
        b=d;
    }
    while(b!=0){
        c=b;
        b=a%b;
        a=c;
    }
    int g=a;
    return(g);
}

int main(){
    int m,n;
    long p;
    int k;
    while(cin>>m>>n){
        p=m*n;
        k=Gcd(m,n);
        cout<<k<<" "<<p/k<<endl;
    }
}
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

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

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;

ll gcd(ll a, ll b)
{
	return b != 0 ? gcd(b, a%b): a;
}

int main(void)
{
	ll a, b, g, l;
	while (cin >> a >> b)
	{
	    g = gcd(a, b);
	    l = a*b / g;
	    cout << g << " " << l << endl;
	}
}

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

//typedef long long lli;

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b);}

int main(){
  int a,b;
  while(cin >> a >> b)
    cout << gcd(a,b) << ' ' << a * b / gcd(a,b) << endl;
}

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

int main(){
    unsigned int a,b,c;
    int g[50];
    int l[50];
    int p;
    for(int i=0;i<50;i++){
        cin>>a>>b;
        p=a*b;
        while(b!=0){
            c=b;
            b=a%b;
            a=c;
        }
        g[i]=a;
        l[i]=p/g[i];
    }
    for(int i=0;i<50;i++){
        cout<<g[i]<<" "<<l[i]<<endl;
    }
    return(0);
}

C++: #include "bits/stdc++.h"
#include <gmp.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;

#define REP(i, a, n) for(ll i = a; i < (ll)n; i++)
#define RREP(i, a, n) for(ll i = n-1; i >= (ll)a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007

template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T, class ...Args> void read(T& a, Args&... args){cin >> a; read(args...);} 
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<char c = ' ',class T> void write(T a){cout << fixed << setprecision(4) << a << endl;}
template<char c = ' ',class T,class ...Args> void write(T a, Args... args){cout << fixed << setprecision(4) << a << c; write<c>(args...);}
template<class T> void warr(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ull gcd(ull a, ull b){while(true){ull k = a % b;if(k == 0)return b;a = b;b = k;}}
ull comb(ull n, ull m){ull p=1;m=min(m,n-m);for(ull i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
    while(!cin.eof()){
        ull a,b;
        read(a,b);
        if(a==0)return 0;
        ull r1=gcd(a,b);
        ull r2=a*b/r1;
        write(r1,r2);
    }
    return 0;
}