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<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
#define int long long
using namespace std;
/*
int Max(int n, int m){
  vector<int> v1;
  vector<int> v2;
  repp(i,n){
    if(n%i == 0) v1.push_back(i);
    if(m%i == 0) v2.push_back(i);
  }
  int t=0;
  rep(i,v1.size()){
    rep(j,v2.size()){
      if(v1[i] == v2[j] && t < v2[j]) t = v2[j];
    }
  }
  return t;
}*/
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
signed main(){
  int n,m;
  while(cin >> n >> m){
    int a = gcd(n,m);
    int b = n/a*m;
    cout << a << " " << b << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
typedef long long int ll;

ll GCD(ll,ll);

int main(void){
	while(1){
		ll a, b, gcd, lcm, temp;
		if( a < b){
			temp = a;
			a = b;
			b = temp;
		}
		cin >> a >> b;
		if(a == 0 || b == 0)
			return 0;
		gcd = GCD(a,b);
		lcm = a * b / gcd;
		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}

ll GCD(ll a, ll b){
	if(a % b == 0)
		return (b);
	else
		return (GCD(b, a%b));
}

C++: #include <iostream>

//?????§??¬?´???°????±???????????????°??????(m >= n)
int calcGcd(int m, int n);
//????°???¬?????°????±????????????????????????°??????
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, a, b;
	
	while(std::cin >> a >> b){
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

inline int calcLcm(int m, int n, int gcd){
	return m / gcd * n;
}

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

using namespace std;

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull a, b;
ull gcd(ull a, ull b){
	return b?gcd(b, a%b):a;
} 
int main(){
	//freopen("in", "r", stdin);
	for(;cin>>a>>b;){
		ull _gcd=gcd(a, b), _lcm=a/_gcd*b;
		cout<<_gcd<<' '<<_lcm<<endl;
	}
}

C++: #include<iostream>
using namespace std;
int gcd(int ,int);
int main(){
  int a,b;
  long long c,d;
  cin>>a>>b;

  d=gcd(a,b);
  c=a*(b/d);
  cout<<d<<' '<<c<<endl;

  return 0;
}

int gcd(int x, int y){
  while(x!=y){
    if(x>y){
      x=x%y;
      if(x==0) return y;
    }
    else{
      y=y%x;
      if(y==0) return x;
    }
  }
  return x;

}

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

int main(){
	long long a, b;
	long 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*b/y) << endl;
	}
	
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double gcd( double m, double n );
double lcm( double m, double n );
int main(int argc, const char * argv[])
{
    double a=0.0;
    double b=0.0;
        
    while(scanf("%lf",&a)!=EOF){
        scanf("%lf",&b);

        double g = gcd(a, b);
        double l = lcm( a,b );
        
        
        printf("%4lf",g);
        printf(" ");
        printf("%4lf\n",l);
        
    }
    
}
double gcd( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n);
}

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

int main(){
	int a,b;
	cin>>a>>b;
	int a2=a;
	int b2=b;
	while(true){
		if(a>b){
			a=a%b;
		}else{
			b=b%a;
		}
		if(a==0||b==0)break;
	}
	cout<<max(a,b)<<" "<<a2/max(a,b)*b2<<endl;
	return 0;
}

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!=0){
	q=b/a;
	r=b%a;
	b=a;
	a=r;
	}
	return b;
}

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

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

int a,b;

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

int main(){
	while(scanf("%d%d",&a,&b)!=EOF){
		if(a>b)swap(a,b);
		int ans=GCD(a,b);
		printf("%d %d\n",ans,b/ans*a);
	}
}

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

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

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

int main (int argc, char const* argv[])
{
    long long int a,b;
    while(cin >> a >> b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int i;
		if(a>=b)
			i=b;
		else
			i=a;
		while(true){
			if(a%i==0&&b%i==0)
				break;
			i--;
		}
		cout<<i<<" ";
		if(a>=b)
			i=a;
		else
			i=b;
		while(true){
			if(i%a==0&&i%b==0)
				break;
			i++;
		}
		cout<<i<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  while(cin>>a>>b){
  c=gcd(a,b);
  d=a*(b/c);
  cout<<c<<' '<<d<<endl;
  }
  return 0;
}

int gcd(long long x,long long y){
  while(x!=y){
    if(x>y){
      x=x%y;
      if(x==0) return y;
    }
    else{
      y=y%x;
      if(y==0) return x;
    }
  }
  return x;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
  ll a, b;
  while(cin >> a >> b) {
    ll g = gcd(a, b);
    ll l = a * b / g;
    printf("%lld %lld\n", g, l);
  }
}

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

int main()
{
	unsigned int a,b ;

	int gcd = 1 ;
	int lcm = 1 ;

	while( cin >> a >> b )
	{
		for( int i = 2 ; i < min(a,b) ; i ++ )
		{
			if( (a %i == 0 ) && (b %i == 0 ) )
			{
				gcd *= i ;
				a = a/i ;
				b = b/i ;

				i = 2 ;
			}
		}

		lcm = gcd * a * b ;

		cout << gcd << " " << lcm ;

		gcd = 1 ;
		lcm = 1 ;
	}

	return 0 ;
}

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

C++: #include<iostream>
using namespace std;
int main() {
	int a, b, c, x, y, z;
	while (cin >> a >> b) {
		y = a;
		z = b;
		if (a < b) {
			x = a;
			a = b;
			b = x;
		}
		while (b > 0) {
			x = a;
			a = b;
			b = x%b;
		}
		c = (y / a)*(z / a)*a;
		cout << a << " " << c << endl;
	}
	return 0;
}