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 count == 51 {
			break
		}
		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>
#include<fstream>
using namespace std;


unsigned long long int GCM(unsigned long long int a,unsigned long long int b){
	while(a!=b){
		a>b? a-=b:b-=a;
	}
	return a;
}

int main()
{
	ifstream ifs("Text.txt");
	unsigned long long int a,b,L,G;
	
	ifs>>a;
	do{
	ifs>>b;
	if(a!=0&&b!=0){
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}
	}while(ifs>>a);
}

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

int main()
{
	int a, b;

	while(cin >> a >> b)
	{
		int l;
	    int g = 1;

		for (int i = 2; a > i && b > i; i++)
		{
			for (int j = 0; a % i == 0 && b % i == 0; j++)
			{
				a = a / i;
				b = b / i;
				g *= i;
			}
		}

		l = g * a * b;
		cout << g << " " << l << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

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

}

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;
  }
}

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

int main(){
  unsigned int a,b,tmp,GCD;
  while ( std::cin >> a >> b){
    if( b > a )std::swap( a , b );
    unsigned long int LCM = a;
    GCD = b;
    while(a % GCD != 0){
      tmp = a % GCD;
      a = GCD;
      GCD = tmp;
    }
    LCM = ( LCM / GCD ) * b;
    std::cout << GCD << " " << LCM << std::endl;
  }
  return 0;
}

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

int main(){
	long long a,b;
	while(cin >> a >> b){
		vector<long long> num;
		long long k = 0;
		long long max = 1;
		for(long long i = 2; i < a/2; i++){
			if(a % i == 0){
				num.push_back(i);
				k++;
			}
		}
		for(long long i = 0; i < k; i++){
			if(b % num[i] == 0){
				max = num[i];
			}
		}
		long long min = (a * b) / max;
		cout << max << " " << min << endl;
	}
	return 0;
}

C++: #include<stdio.h>
int gcd(unsigned int M,unsigned int N)
{
    if(M%N==0)return N;
    return gcd(N,M%N);
}
int main()
{
    unsigned int M,N,t;
    while(scanf("%u%u",&M,&N)!=EOF)
    {
        t=gcd(M,N);
        printf("%u %u\n",t,M*N/t);
    }
    return 0;
}

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

typedef unsigned long long L;
int main(){
	for(L a,b,c,d,e; cin>>a>>b;){
		for(c=a,d=b;;){
			e = c % d;
			c = d;
			d = e;
			if(!e)break;
		}
		cout<<c<<" "<<a*b/c<<endl;
	}
}

C++: #include<iostream>

using namespace std;

int gcd(int,int);
int lcm(int,int);

main(){

  int a, b;

  
  while(cin >> a >> b){

    cout << gcd(a,b) << " "<<lcm(a,b) << endl;

    

  }

}


int gcd( int m, int n )
{
	// [NbhÌû@
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd


// Å¬ö{iLeast Common MultiplejðÔ·B// øÉOª éêÍOðÔ·B

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

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f;
    cin>>a>>b;
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    
    return 0;
}

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=1;i<min(a, b);i++){
    if(a%i==0 && b%i==0){
      max = i;
    }
  }
  return max;
}

int find_LCM(int a, int b){
  int LCM;
  for(int i = max(a, b)+1;;i++){
    if(i%a==0 && i%b==0){
      LCM = i;
      break;
    }
  }

  return LCM;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
        cout << find_GCD(a, b) << " " << find_LCM(a, b) << endl;
  }

}

C++: #include <iostream>
#include <stdio.h>

using namespace std; 

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

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  while(1){
    cin >> a >> b;
    if(cin.eof())
      break;
    int g=gcd(a,b);
    //printf("%d %d\n",g,a/g*b);
    cout << g << ' ' << a/g*b << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <math.h>

using namespace std;

void solve(int a, int b) {
	int min_num = min(a,b);
	int gcj = 0;
	for (int i=min_num; i>0; i--) {
		if (a%i==0 && b%i==0)
			gcj = max(gcj, i);
	}
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int main(){

  int a,b;
  int yaku,bai;
  while(cin >> a >> b){
    for(yaku=a;1<yaku;yaku--)
      if(a%yaku==0 && b%yaku==0)
	break;

    for(bai=2;bai<=a;bai++)
      if((bai*b)%a==0){
	bai *= b;
	break;
      }
    cout << yaku << ' ' << bai << endl;
  }
  return 0;
}

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

using namespace std;

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

int main(){
        long long a, b;
        while (cin >> a >> b){
                if (a < b) swap(b, a);
                long g = gcd(a, b);
                cout << g << " " << a * b / g << endl;
        }
        return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1,ch2;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    for(int i=1;i<=(a/2);i++){
      if(a%i==0)
	ayaku.push_back(i);
    }
    for(int j=1;j<=(b/2);j++){
      if(b%j==0)
	byaku.push_back(j);
    }
    for(int i=0;i<ayaku.size();i++){
      for(int j=0;j<byaku.size();j++){
	if(ayaku[i]==byaku[j]&&max<byaku[j])
	  max=byaku[j];
      }
    }//?????§??¬?´???°??????
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}

C++: #include <stdio.h>

int main()
{
	long int a,b,a1,b1;
	long int r;
	while(scanf("%ld %ld",&a1,&b1) != EOF){
		a = a1;
		b = b1;
		if(a < b){
			r = b;
			b = a;
			a = r;
		}
		if(a < 0 || b < 0){
			return 0;
		}
		r = a % b;
		while(r != 0){
			a = b;
			b = r;
			r = a % b;
		}
		printf("%ld %ld", b, a1 / b * b1);
	}
	return 0;
}

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

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 <stdio.h>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    //gcd = u(a, b);
   lcm = l(a, b);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a!=1 || b!=1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  int odd = 1;
  if(a%2==0) return 2;
  else i++;
  
  while(1){
    if(a%i==0){
      if(b%i==0){break;}
      else{i += 2;}
    }else{
      i += 2;
    }
  }
  return i;
}