Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

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

C++: #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <vector>
using namespace std;

int gcd(int x, int y) { return y > 0 ? gcd(y, x % y) : x; }

int main(int argc, char const *argv[]) {
  int a, b, tmp;
  while (!(cin >> a >> b).eof()) {
    if (a < b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    std::cout << gcd(a, b) << ' ' << 1ll * a * b / gcd(a, b) << '\n';
  }
  return 0;
}

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


const int GCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	return y;
}

const int LCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	return a*b/y;
}


int main(int,char**){
	int a,b;
	while(std::cin >>a){
		std::cin >> b;
		std::cout << GCM(a,b) << ' ' << LCM(a,b)<<std::endl;
	}
	return 0;
}

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

using namespace std;

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

int main(void){
	int a,b;
	vector<int> gcd;
	vector<int> lcd;
	while (cin >> a >> b){
		if (a < b){
			swap(a,b);
		}
		int hiyosu = a;
		int yosu = b;
		int amari = -1;
		while (amari != 0){
			amari = hiyosu % yosu;
			hiyosu = yosu;
			yosu = amari;
		}
		gcd.push_back(hiyosu);
		lcd.push_back(a*(b/hiyosu));
	}
	for (unsigned int i=0; i<gcd.size(); ++i){
		cout << gcd[i] << " " << lcd[i] << endl;
	}
	return 0;
}

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

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (i = 1; i <= minimum; i++) {
            if (a % (minimum - i + 1) == 0 & b % (minimum - i + 1) == 0) {
                i = minimum - i + 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

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

int gcd(int a, int b) {
   int p,q,r;
   if(a<b){p=b;b=a;a=p;}
   while(r!=0){
       q=b/a;
       r=b%a;
       b=a;
       a=r;
   }
   return b;
}

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

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
int a,b,x,y,L;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x==y){break;}
  else if(x==0)break;
  else if(y==0)break;
  else if(x<y){y=y-x;x=x-y;}
  else{x=x-y;y=y-x;}
}
(float)L=((float)a*(float)b)/(float)x;
cout<<y<<" ";printf("%f",L);cout<<endl;
}
  return 0;
}