Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

C++: #include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>

using namespace std;
int gcd(int x,int y)
{
	if (y==0)
	{
		return x;
	}
	else
	{
		return gcd(y, x%y);
	}
}
int lcm(int x, int y)
{
	return x / gcd(x, y)*y;
}

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

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

using namespace std;

int main(){
   int a,b;
   double A,B;
   double GCD,LCM;
   double z;
   
   while(cin>>A>>B){
      if(A<B){
         z = A;
         A = B;
         B = z;
      }
      a = static_cast<int>(A);
      b = static_cast<int>(B);
   
      while(1){
         if(a%b == 0){
            GCD = static_cast<double>(b);
            break;
         }
         z = a%b;
         a = b;
         b = z;
      }
      LCM = A*B/GCD;
      
      printf("%.0lf %.0lf\n",GCD,LCM);
   }
   return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
	int n = 45000;
	int p[n] = {0};
	for(int i=2;i<n;i++){
		if(p[i]==0) for(int j=2;j<n/i;j++) p[i*j] = 1;
	}
	int q[n];
	int c = -1;
	for(int i=2;i<n;i++){
		if(p[i]==0){
			c++;
			q[c] = i;
		}
	}
	long a,b;
	while(cin >> a >> b){
		int t[c] = {0};
		int s[c] = {0};
		int as = a;
		while(1){
			int temp = as;
			for(int i=0;i<c;i++){
				if(as%q[i]==0){
					s[i]++;
					as = as/q[i];
				}
			}
			if(temp==as) break;
		}
		int at = b;
		while(1){
			int temp = at;
			for(int i=0;i<c;i++){
				if(at%q[i]==0){
					t[i]++;
					at = at/q[i];
				}
			}
			if(temp==at) break;
		}
		long z = 1;
		if(at==as) z = at;
		long y = z;
		cout << z << " " << y << endl;
		for(int i=0;i<c;i++){
			y *= pow(q[i],max(s[i],t[i]));
			z *= pow(q[i],min(s[i],t[i]));
		}
		cout << z << " " << y << endl;
	}
}

C++: #include <cstdio>
int gcd(int a, int b){
	return b?gcd(b,a%b):a;
}
int main(){
	int a,b;
	while(~scanf("%d%d",&a,&b))
		printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
}

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

using _i64 = int64_t;
using _u64 = uint64_t;
using _f64 = double;

#define _for(i, start, end) for(_i64 i = (_i64)start; i < (_i64)end; ++i)
#define _rep(i, number) _for(i, 0, number)
#define _foreach(e, data) for(auto& e : data)
#define _all(data) data.begin(), data.end()

template<typename type>
_i64 _size(const type& data) { return static_cast<_i64>(data.size()); }
template<typename type, size_t size>
_i64 _size(const type (&)[size]) { return static_cast<_i64>(size); }

enum _flag : bool { able = true, disable = false };

struct _time {
    _time(_flag flag) { check = flag; if(!check) { return; } gettime(start); }
    ~_time() {
        if(!check) { return; }; gettime(end);
        _i64 elapse = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cout << endl << "Time: " << elapse << " ms" << endl;
    }
    private:
    using _timer = chrono::time_point<chrono::system_clock>;
    _timer start, end; bool check;
    void gettime(_timer& time) { time = chrono::system_clock::now(); }
};

struct _ini { _ini() { ios::sync_with_stdio(false); cin.tie(nullptr); } } _ini;

_i64 _gcd(_i64 a, _i64 b) {
    return (max(a, b) % min(a, b) != 0 ? _gcd(min(a, b), max(a, b) % min(a, b)) : min(a, b));
}

_i64 _lcm(_i64 a, _i64 b) {
    return a * b / _gcd(a, b);
}

int main() {
    {
        _time time(disable);
        _i64 a, b;
        while(cin >> a >> b) { cout << _gcd(a, b) << " " << _lcm(a, b) << endl; }
    }
    return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL lcm(LL a,LL b){
	return a*b/__gcd(a,b);
}
int main(){
	LL a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF){
		printf("%lld %lld\n",__gcd(a,b),lcm(a,b));
	}
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int a, b;
  while (cin >> a >> b) {
    cout << gcd(a, b) << " " << lcm(a, b) << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<string>
#include<cstdio>
#include<stack>
#include<cmath>
#include<bitset>
#include<memory>
#include<utility>
using namespace std;
#define FOR(i,m,n) for(i=m;i<n;i++)
#define CLR(a,b) memset(a,b,sizeof(a))
#define ROF(i,m,n) for(i=m;i>=n;i--)
#define BUG cout<<"debug"<<endl;
#define RT return
#define BK break
#define HEAP priority_queue
#define SP " "
#define lowf(a,b,c) lower_bound(a,b,c)
#define upf(a,b,c) upper_bound(a,b,c)
typedef long long LL;
typedef vector<int> VI;
const int INF = 2147483647;
const int NEN = -INF - 1;
const LL LINF = 9223372036854775807;
LL gcd(LL a, LL b)
{
	return b ? gcd(b, a%b):a;
}
int main()
{
	LL a, b,c;
	while (cin >> a >> b)
	{
		c = gcd(a, b);
		cout << c << " " << a*b / c << endl;
	}
    return 0;
}

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

int main(){

  int a, b;
  int lcm=1, gcd=1;

  while( cin >> a >> b ) {
    for(int i=a; i>1; i--) {
      if(a%i == 0 && b%i == 0) {
        lcm = i;
        a = a/i;
        b = b/i;
        i = a;
      }
    }
    gcd = a*b*lcm;
    cout << lcm << " " << gcd <<"\n";
    lcm = 1;
    gcd = 1;
  }

  return 0;
}

C++: #include<iostream>
#include<vector>
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())return 0;
    int g = gcd(a,b);
    cout << g << ' '<<a/g*b;
  }
}

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

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

int main()
{   int n;
    cin>>n;
    while(n--)
    {
           int min,max,a,b;
    cin>>a>>b;
    max = gcd(a,b);
    min = (a/max)*(b/max)*max;
    cout << max << " " << min<<endl;
    }
    return 0;
}

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

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)

int a, b, gcd, lcm;

void GCD(int x, int y)
{
	if (x < y) swap(x, y);
	x = x % y;
	if (x != 0) GCD(x,y);
	else gcd = y;
}

int main()
{

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

C++: #include <stdio.h>

long GetGCD(long x, long y);

int main(void){
    long  n,m,gcd,lcm;
    
    while (scanf("%d %d", &n, &m)!=EOF){
        gcd = GetGCD(n,m);
        lcm = n * m / gcd;
        printf("%d %d\n", gcd, lcm);
    }
    return 0;
}

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