Go: package main

import "fmt"

func main() {
	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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

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

int gcd(int m, int n)
{
	// ?????°?????????????????´??????????????????
	if ((0 == m) || (0 == n))
		return 0;

	// ???????????????????????????
	while (m != n)
	{
		if (m > n) m = m - n;
		else         n = n - m;
	}
	return m;
}

int lcm(int m,int n)
{
	// ?????°?????????????????´??????????????????
	if ((0 == m) || (0 == n))
		return 0;

	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

int main() {
	long int m, n;
	while (cin >> m >> n) {
		cout << gcd(m, n) << " " << lcm(m, n) << endl;
	}
	return 0;
}

C++: //GCD and LCM
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll gcd(ll x, ll y){
  if(y==0)return x;
  else return gcd(y, x%y);
}

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

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

C++: #include <iostream>

#include <algorithm>


using namespace std;
int main()
{

int x,y,n,a,b;

while(cin>>x>>y)
{
 a=x;
 b=y;
 if(x>y)
 {
 while(x%y!=0)
  {
   n=x%y;
   x=y;
   y=n;
   cout<<y<<" "<<a*b/y<<endl;
  }
 }
  else
  {
  while(y%x!=0)
  {
   n=y%x;
   y=x;
   x=n;
   cout<<x<<" "<<a*b/x<<endl;
  }
 }
}
return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
long int gcd(long int,long int);
long int lcm(long int,long int);
long int tes(long int,long int);

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

long int gcd(long int a,long int b){
  long int n;
  n=min(a,b);
  for(long int i=n;i>=1;i--){
    if(a%i == 0 && b%i==0)return i;
  }

}

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

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

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

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

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

int main() {
	ios_base::sync_with_stdio( false );

	int a, b;
	while( (cin >> a) && (cin >> b) ) {
		cout << gcd( a, b ) << ' ' << lcm( a, b ) << '\n';
	}
}

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

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

int lcm(int a, int b)
{
    int temp = gcd(a, b);

    return temp ? (a / temp * b) : 0;
}

int main()
{
    int a,b;
    while(cin>>a>>b) {
		printf("%d %d\n",gcd(a,b),lcm(a,b));
    }
    return 0;
}

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

int euclid(int b, int c){
	int a;
	while (c != 0){
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}

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

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
	int a, b;
	while (cin >> a&&cin >> b) {
		int min, max;
		int ans1, ans2;
		if (a > b) {
			min = b;max = a;
		}
		else {
			min = a;max = b;
		}
		for (int i = min;i >= 1;i--)
		{
			if (a%i == 0 && b%i == 0)
			{
				ans1 = i;
				break;
			}
		}
		for (int i = max;;i++)
		{
			if (i%a == 0 && i%b == 0)
			{
				ans2 = i;
				break;
			}
		}
		cout << ans1 << " " << ans2 << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void){
	long a=0, b=0;
	long x=0;
	long m=0, n=0;
	while(scanf("%d %d", &a, &b) != EOF){
		if(a<b){
			x=b;b=a;a=x;
		}
		m=a;n=b;
		while(n != 0){
			x = n;
			n = m % n;
			m = x;
		}
		printf("%d %d\n", m, a/m*b);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);  // ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y);  // ????°???¬?????°????±?????????¢??°

int main()
{
	int x, y;
	while (cin >> x >> y){
	cout << gcd(x, y) << " " << lcm(x, y) << endl;
	}

	return 0;
}

// ?????§??¬?´???°????±?????????¢??°
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	// ????????°?????????????????????
	while ((r = x % y) != 0) // y??§????????????????????§?????????
	{
		x = y;
		y = r;
	}
	return y;
}

// ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	return (x * y / gcd(x, y));
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    while(cin >> a >> b) {
        int g = __gcd(a, b);
        cout << g << ' ' << a / g * b << endl;
    }
}

C++: #include<iostream>

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

int main(){
  int a, b, k;

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

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

void swap(int& a, int& b)
{
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
}

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

int main()
{
        int a, b;
        int g, l;

        while(scanf("%d %d", &a, &b) != EOF){
                if(a<b){ swap(a, b); }
                g = gcd(a, b);
                l = a/g*b;
                cout << g << " " << l << endl;
        }
        return 0;
}

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

long long 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 <iostream>
using namespace std;
int main()
{
   int a,b,d,e;
  cin>>a>>b;
  for(int i = a; i>0;i--){
    if(a%i== 0&& b%i == 0)
        d = i ;
}
 for(int j = a; j <= a*b;++j){
     if(j%a == 0&& j%b == 0){
       e =j;
     }
 }

 cout<<d<<" "<<e<<endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
long gcd(long a, long b) {
  while (b != 0) {
    long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long lcd(long a, long b) {
  long g = gcd(a, b);
  return (a * b) / g;
}
int main() {
  long a, b;
  while (cin >> a >> b) {
    cout << gcd(a, b) << " " << lcd(a, b) << endl;
  }
}

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

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

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

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

C++: #include <cstdio>
#include<iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstring>
#include <string.h>
#include<vector>
#include <set>
#include <vector>
#include <iterator>
using namespace std;
typedef long long int ll;

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

 int main()
 {
     ll a, b;
     while(~scanf("%lld %lld", &a, &b))
     {
         printf("%lld %lld\n", gcd(a, b), LCM(a, a, b));
     }
     return 0;
 }

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

long gcd(long, long);

int main()
{
	long a,b;

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

	return 0;

}

long gcd(long a, long b) //a>=b
{
	if(b==0){
		return a;
	} else {
		return gcd(b, a%b);
	}
}