#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int at,bt;
int judge(int m,int n,int p)
{
    if(at) return 0;
    if(m==1&&n==1){
        at=1;
        return 0;
    }
    if(n==1) bt=1;
    while(p>1)
    {
        if(m%p==0) judge(m/p,n,p-1);
        if(n%p==0) judge(m,n/p,p-1);
        p--;
    }
    return 0;
}

int main(){
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        if(a<b)
        {
            int tmp=a;
            a=b;
            b=tmp;
        }
        at=0;
        bt=0;
        judge(a,b,100);
        if(!at&&bt)
            printf("%d\n",b);
        else
            printf("%d\n",a);
    }
    return 0;
}

 

posted on 2017-07-31 16:08  可馨517  阅读(228)  评论(0编辑  收藏  举报