import sys                                               
for i in sys.stdin:
    lst = i.split(' ')
    lst = map(int, lst)
    lst.sort()

    n = 1
    maxn = 1
    while n*n <= lst[0]:
        if lst[0]%n == 0 and lst[1]%(lst[0]/n) == 0:
            print lst[0]/n
            break
        elif lst[0]%n == 0 and lst[1]%n == 0:
            maxn = n
        n = n+1
    else:
        print maxn
    sys.exit(0) import sys sys for i in sys.stdin:
    lst = i.split(' ')
    lst = map(int, lst)
    lst.sort()

    n = 1
    maxn = 1
    while n*n <= lst[0]:
        if lst[0]%n == 0 and lst[1]%(lst[0]/n) == 0:
            print lst[0]/n
            break
        elif lst[0]%n == 0 and lst[1]%n == 0:
            maxn = n
        n = n+1
    else:
        print maxn
    sys.exit(0) i sys.stdin sys stdin lst = i.split(' ') lst i.split(' ') i.split i split ' ' lst = map(int, lst) lst map(int, lst) map int lst lst.sort() lst.sort lst sort n = 1 n 1 maxn = 1 maxn 1 while n*n <= lst[0]:
        if lst[0]%n == 0 and lst[1]%(lst[0]/n) == 0:
            print lst[0]/n
            break
        elif lst[0]%n == 0 and lst[1]%n == 0:
            maxn = n
        n = n+1
    else:
        print maxn
     n*n <= lst[0] n*n n n lst[0] lst 0 if lst[0]%n == 0 and lst[1]%(lst[0]/n) == 0:
            print lst[0]/n
            break
        elif lst[0]%n == 0 and lst[1]%n == 0:
            maxn = n
         lst[0]%n == 0 and lst[1]%(lst[0]/n) == 0 lst[0]%n == 0 lst[0]%n lst[0] lst 0 n 0 lst[1]%(lst[0]/n) == 0 lst[1]%(lst[0]/n) lst[1] lst 1 lst[0]/n lst[0] lst 0 n 0 print lst[0]/n lst[0] lst 0 n break elif lst[0]%n == 0 and lst[1]%n == 0:
            maxn = n
         lst[0]%n == 0 and lst[1]%n == 0 lst[0]%n == 0 lst[0]%n lst[0] lst 0 n 0 lst[1]%n == 0 lst[1]%n lst[1] lst 1 n 0 maxn = n maxn n n = n+1 n n+1 n 1 print sys.exit(0) sys.exit sys exit 0 n = n+1 n+1 n maxn = n n maxn lst = i.split(' ') i.split(' ') lst n = 1 1 n maxn = 1 1 maxn lst = map(int, lst) map(int, lst) lst
import sys                                               
for i in sys.stdin:
    lst = i.split(' ')
    lst = map(int, lst)
    lst.sort()

    n = 1
    maxn = 1
    while n*n <= lst[0]:
        if lst[0]%n == 0 and lst[1]%(lst[0]/n) == 0:
            print lst[0]/n
            break
        elif lst[0]%n == 0 and lst[1]%n == 0:
            maxn = n
        n = n+1
    else:
        print maxn
    sys.exit(0)