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>
using namespace std;

int gcd(int a,int b) {
	int r;
	while (1) {
		if (a > b) {
			r = a%b;
			if (r == 0) {
				break;
			}
			a = b;
			b = r;
			return b;
		}
		if (a < b) {
			r = b%a;
			if (r == 0) {
				break;
			}
			b = a;
			a = r;
			return a;
		}
	}
}

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

C++: #include<stdio.h>

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

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

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

long long gcd(long long x,long long y){
	return (y==0?x:gcd(y,x%y));
}

int main(){
	long long a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		printf("%lld %lld\n",gcd(a,b),a/gcd(a,b)*b);
	}
	return 0;
}

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

long gongyueshu(long a,long b);
int  main()
{
	long  a,b,c,d;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
	

	c=gongyueshu(a,b);
	d=a/c*b;
	
	cout<<c<<" "<<d<<endl;
	return 0;
}
	
	
} 
long gongyueshu(long a,long b)   
{
	if(a%b==0)
  return b;
 return gongyueshu(b,a%b);
}

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

int main(void){
    long long a,b,c,d,x,ans01,ans02;
    int count = 0;
    while(std::cin >> a >> b && count <= 50){
        if(b > a){
           x = a;
           a = b;
           b = x;
        }
        c = a % b;
        d = b % c;
        if(d == 0) {
            ans01 = c;
            ans02 = a * b / c;
        }
        else if (c % d == 0) {
            ans01 = d;
            ans02 = a * b / d;
        }
        std::cout << ans01 << " " << ans02 << std::endl;
        count ++;
    }
    return 0;
}

C++: #include <iostream>
#include <boost/math/common_factor.hpp>
#include <boost/bind.hpp>
using namespace std;
using namespace boost;

int main(){
  int a, b;

  while(cin >> a >> b){
    
    cout<<boost::math::gcd(a, b)<< ' ';
    cout<<boost::math::lcm(a, b)<<std::endl;
    
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

unsigned long long int GCD(unsigned long long int a, unsigned long long int b)
{
	if(a % b == 0)
	{
		return(b);
	}
	GCD(b, a % b);
}

void solve()
{
	unsigned long long int a, b;
	while(cin >> a >> b)
	{
		if(a < b)
		{
			swap(a, b);
		}
		unsigned long long int gcd = GCD(a, b);
		cout << gcd << " " << a * b / gcd << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

using namespace std;

int main() {
	long int  a, b;
	while (cin >> a >> b) {
		/*cout << __gcd(a, b) << " " << a * b / gcd(a, b) << endl;*/

		cout << a * b / (a / __gcd(a, b)*b) << " " << a / __gcd(a, b)*b << endl;
	}

}

C++: #include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int main(){
	long a, b;
	long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

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

using namespace std;

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

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

int main() {
	int a, b;
	while (scanf("%d%d", &a, &b) != EOF) {
		printf ("%d %d\n", gcd(a, b), lcm(a, b));
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int  a,b,c,x,y;
	long long i;
	scanf("%d %d",&a,&b);
    i=(long long)a*b;
	if(a<b){
	    c=a;
		a=b;
		b=c;
	}
	c=a%b;
	while(c!=0){
	    a=b;
		b=c;
		c=a%b;
	}
	i=(long long)i/b;
	printf("%d %lld\n",b,i);
	return 0;
}

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

int main(){
  int a, b;
  while(cin >> a >> b){

    int ma = max(a, b);
    int mi = min(a, b);

    long gcd = 0, lcm = 0;

    for(int i = 0; i < mi; i++){
        if(ma % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((ma * j) % mi == 0){ 
        lcm = ma * j;
        break;
      }
      else{ 
        j++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

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

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

int main(){
    int a, b, GCD;
    while(std::cin >> a >> b){
        if(a < b)
            std::swap(a, b);
        GCD = getGCD(a, b);
        std::cout << GCD << " " << (a*b)/GCD <<std::endl;
    }
}

C++: #include <stdio.h>

int main() {
  int a, b, i, j, x, y;
  while(scanf("%d %d", &a, &b) != EOF) {
    if(a > b) j = b;
    else      j = a;
    x = 0;
    for(i = j; i > 0; i--) {
      if(a % i == 0 && b % i == 0) {
	x = i;
	break;
      }
    }

    if(b > a) j = b;
    else      j = a;
    y = 0;
    for(i = j; i <= 2000000000; i++) {
      if(i % a == 0 && i % b == 0) {
	y = i;
	break;
      }
    }

    printf("%d %d\n", x, y);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y) {
  while (y != 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

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

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

C++: #include <iostream>
using namespace std;
int main(){
    long int a,b,gcd=0,lcm=0,min=0;
    cin>>a>>b;
    if(b>a)min=a;
    else min=b;
    
    for(long int k=min;k>=1;k--){
        if(a%k==0&&b%k==0) {
            lcm=k;
            break;
        }
    }
    
   gcd=a*b/lcm;
    
    cout<<lcm<<" "<<gcd<<endl;
    
}

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

long func(long p, long q);
// int lcm(long p, long q);

int main() {
	long a, b;
	while(cin >> a >> b && a != EOF) {
		long gcd = func(a, b);
		long lcm = a / gcd * b;
		
		cout << gcd << ' ' << lcm << endl;
	}
}

long func(long p, long q) {
	long R = p % q;
	return (R==0? q : func(q,R));
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

ll gcd(ll a,ll b){
	if(a<b){
		swap(a,b);
	}

	while(ll r=(a%b)){
		a = b;
		b = r;
	}
	return b;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a;
	while(cin>>a){
		auto b=in();

		out(gcd(a,b),lcm(a,b));
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

long long gcd(int x, int y)
{
  return y?gcd(y, x%y):x;
}

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

int main()
{
  long long a, b;
  while(scanf("%lld%lld", &a, &b) != -1){
    if(b > a){
      a += b;
      b = a - b;
      a -= b;
    }
    printf("%lld %lld\n", gcd(a, b), lcm(a, b));
  }
  return 0;
}