Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

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;

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