#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)
      i++;
    else j++;
  }  
  if(a<b){
    for(i=2;i<a+1;i++)
      if(a%i==0 && b%i==0)break;
      cout<<i<<endl;
  }
  else {
      for(i=2;i<b+1;i++)
	if(a%i==0 && b%i==0)break;
      cout<<i<<endl;
  } 

  cout<<a2<<endl; 
  return 0;
}