#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(1){
    if(a==1) return b;
    else     return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % 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;
}