Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts()(a, b int){
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

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

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

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

long long int LCM(long long int a, long long int b) {
    return (a / GCD(a, b)) * b;
}

int main() {
    long long int a, b;
    while (cin >> a >> b) {
        cout << GCD(a, b) << " " << LCM(a, b) << endl;
    }    
    return 0;
}

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

int main(void)
{
	long long num1, num2, G, L, ans1, ans2;

	while (cin >> num1 >> num2) {
		L = num1;
		ans1 = num1; ans2 = num2;
		for (long long i = 2; i < num1 && i < num2; i++) {
			if ((num1 % i) == 0 && (num2 % i) == 0) G = i;
			while ((ans1 % i) == 0 && (ans2 % i) == 0) {
				G = i;
				ans1 /= i;
				ans2 /= i;
			}
		}
		cout << G << " " << L*ans2 << endl;
	}
	return 0;
}

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

int main(){
	int a, b, r, gcd, lcm, x, y;

	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

int gcd(int a, int b) {
  int r;
  while (r = a % b) {
    a = b;
    b = r;
  }
  return b;
}

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

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

int main()
{
	int x, y;
	while (~scanf("%d%d", &x, &y)){
		int gcd = __gcd(x, y);
		printf("%d %d\n", gcd, x / gcd * y);
	}
}

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

int64_t gcd(int64_t a, int64_t b){
  while(a % b != 0){
    int64_t tmp = a % b;
    a = b;
    b = tmp;
  }
  return b;
}

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

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

int gcd(int x,int y){
  if(x%y==0) return n;
  else{
    int z=x%y
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

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

  return 0;
}

C++: #include<iostream>
using namespace std;
int GCD(int n,int m){
  if(n<m){
    int t;
    t = m;
    m = n;
    n = t;
  }
  int i;
  while(n%m != 0){
    i = n%m;
    n = m;
    m = i;
  }
  return m;
    
}
int main(){
  int n,m,i=0,a[50],b[50];
  while(cin >> n >> m){
    a[i] = GCD(n,m);
    b[i] = n*m/GCD(n,m);
    i++;
    n = 0;
    m = 0;
  }
  for(n=0;n<i+1;n++) cout << a[n] << " " << b[n] << endl;
???return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define INF (1<<24)
 
bool isNum(char ch){return ('0'<=ch&&ch<='9');}
 
struct calcStr{
  string s;
  int pos,len;
  bool flag;
 
  void init(){ pos=0;len=s.size();flag=false;}
 
  int head2Num(){
    if(pos+1<len&&s[pos]=='0'&&isNum(s[pos+1]))flag=true;
    int res=0;
    while(pos<len){
      if(isNum(s[pos])){
    res*=10;
    res+=(s[pos]-'0');
    pos++;
      }else break;
    }
    return res;
  }
   
  int getNum(){
    int res=head2Num(),num;
    char ch;
    while(s[pos]=='*'||s[pos]=='/'){
      ch=s[pos++];
      num=head2Num();
      if(ch=='*')res*=num;
      else if(ch=='/'){
    if(num==0){flag=true;num=1;}
    if(res%num>0)flag=true;
    res/=num;
      }
    }
    return res;
  }
   
  int getAns(){
    if(!isNum(s[0]))return INF;
    for(int i=1;i+1<len;i++)if(!isNum(s[i-1])&&!isNum(s[i]))return INF;
 
    int res=getNum(),num;
    while(1){
      if(s[pos]=='=')break;
      char ch=s[pos++];
      num=getNum();
      if(ch=='+')res+=num;
      else if(ch=='-')res-=num;
    }
    if(flag)return INF;
    else return res;
  }
};
 
int H,W,N,M,e;
string str;
string v;
char t[100][100];
char u[100];
vector<string> w,w2;
 
bool solve();
bool check();
bool compute(int);
 
int main(){
  while(1){
    cin>>H>>W;
    if(H==0&&W==0)break;
    M=0;
    w.clear();
    for(int i=0;i<H;i++){
      cin>>str;
      for(int j=0;j<W;j++){
    t[i][j]=str[j];
    if(t[i][j]=='.'){
      t[i][j]='A'+M;
      M++;
    }
      }
    }
    cin>>N;
    for(int i=0;i<N;i++)cin>>u[i];
     
    string tmp;
    for(int i=0;i<H;i++){
      tmp="";
      for(int j=0;j<W;j++){
    if(t[i][j]=='=')e=j;
    if(t[i][j]=='#'){
      if(tmp.size()>=3&&e>0&&e+1<tmp.size()){
        w.push_back(tmp.substr(0,e));
        w2.push_back(tmp.substr(e+1));
      }
      tmp="";
    }else tmp.push_back(t[i][j]);
      }
      if(tmp.size()>=3&&e>0&&e+1<tmp.size()){
    w.push_back(tmp.substr(0,e));
    w2.push_back(tmp.substr(e+1));
      }
    }
     
    for(int i=0;i<W;i++){
      tmp="";
      for(int j=0;j<H;j++){
    if(t[j][i]=='=')e=j;
    if(t[j][i]=='#'){
      if(tmp.size()>=3&&e>0&&e+1<tmp.size()){
        w.push_back(tmp.substr(0,e));
        w2.push_back(tmp.substr(e+1));
      }
      tmp="";
    }else tmp.push_back(t[j][i]);
      }
      if(tmp.size()>=3&&e>0&&e+1<tmp.size()){
    w.push_back(tmp.substr(0,e));
    w2.push_back(tmp.substr(e+1));
      }
    }
 
    cout<<(solve()?"Yes":"No")<<endl;
  }
  return 0;
}
 
bool solve(){
  sort(u,u+N);
  do{
    if(check())return true;
  }while(next_permutation(u,u+N));
  return false;
}
 
bool check(){
  for(int i=0;i<(int)w.size();i++)if(!compute(i))return false;
  return true;
}
 
bool compute(int x){
  calcStr a,b;
  a.s="";
  b.s="";
  for(int i=0;i<(int)w[x].size();i++){
    if('A'<=w[x][i]&&w[x][i]<='Z')a.s.push_back(u[w[x][i]-'A']);
    else a.s.push_back(w[x][i]);
  }
  for(int i=0;i<(int)w2[x].size();i++){
    if('A'<=w2[x][i]&&w2[x][i]<='Z')b.s.push_back(u[w2[x][i]-'A']);
    else b.s.push_back(w2[x][i]);
  }

  a.s.push_back('=');
  b.s.push_back('=');
  a.init();
  b.init();
  int A=a.getAns();
  int B=b.getAns();
  if(A==INF||B==INF)return false;
  return (A==B);
}

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

void test1();
int GCD(int a, int b);
int LCM(int a, int b, int gcd);

int main(void)
{
	test1();

	return 0;
}

void test1()
{
	int a, b;
	unsigned int iGcd, iLcm;

	while (cin >> a >> b)
	{
		iGcd = GCD(a, b);
		iLcm = LCM(a, b, iGcd);

		cout << iGcd << " " << iLcm << endl;
	}
}

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

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

C++: #include <stdio.h>
#include <iostream>
#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);
    std::cout << lcm << " " << gcd << std::endl;
  }
  
  return 0;
}

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

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