x,y = map(int,raw_input().split())
if x==y:
    print x
else:
    if y>x:
        tmp = x
        x = y
        y = tmp
    i=2
    ans = 1
    al = []
    while i*i<=x:
        if x % i ==0:
            if y % i==0:
                al.append(i)
                x = x/i
                y = y/i
                continue
        i+=1
    if len(al)==0:
        pass
    else:
        for j in al:
            ans *= j
    print ans x,y = map(int,raw_input().split()) x map(int,raw_input().split()) map int raw_input().split() ().split () raw_input split y if x==y:
    print x
else:
    if y>x:
        tmp = x
        x = y
        y = tmp
    i=2
    ans = 1
    al = []
    while i*i<=x:
        if x % i ==0:
            if y % i==0:
                al.append(i)
                x = x/i
                y = y/i
                continue
        i+=1
    if len(al)==0:
        pass
    else:
        for j in al:
            ans *= j
    print ans x==y x y print if y>x:
        tmp = x
        x = y
        y = tmp
     y>x y x tmp = x tmp x x = y x y y = tmp y tmp i=2 i 2 ans = 1 ans 1 al = [] al [] while i*i<=x:
        if x % i ==0:
            if y % i==0:
                al.append(i)
                x = x/i
                y = y/i
                continue
        i+=1
     i*i<=x i*i i i x if x % i ==0:
            if y % i==0:
                al.append(i)
                x = x/i
                y = y/i
                continue
         x % i ==0 x % i x i 0 if y % i==0:
                al.append(i)
                x = x/i
                y = y/i
                continue
         y % i==0 y % i y i 0 al.append(i) al.append al append i x = x/i x x/i x i y = y/i y y/i y i continue i+=1 i 1 if len(al)==0:
        pass
    else:
        for j in al:
            ans *= j
     len(al)==0 len(al) len al 0 for j in al:
            ans *= j
     j al ans *= j ans j print x,y = map(int,raw_input().split()) map(int,raw_input().split()) x y = y/i y/i y i+=1 1 i y = tmp tmp y tmp = x x tmp x = y y x al = [] [] al i=2 2 i ans = 1 1 ans ans *= j j ans y = map(int,raw_input().split()) map(int,raw_input().split()) y x = x/i x/i x
x,y = map(int,raw_input().split())
if x==y:
    print x
else:
    if y>x:
        tmp = x
        x = y
        y = tmp
    i=2
    ans = 1
    al = []
    while i*i<=x:
        if x % i ==0:
            if y % i==0:
                al.append(i)
                x = x/i
                y = y/i
                continue
        i+=1
    if len(al)==0:
        pass
    else:
        for j in al:
            ans *= j
    print ans