num = input().split()
if int(num[0])<int(num[1]):
    x = int(num[1])
    y = int(num[0])
else:
    x = int(num[0])
    y = int(num[1])

end = 0
    
z = x % y
if z == 0:
    print(y)
else:
    while True:
        z1 = y % z
        y1 = z
        if z1 == 0:
            print(z)
            break 
        z = z1
        y = y1     num = input().split() num input().split() ().split () input split if int(num[0])<int(num[1]):
    x = int(num[1])
    y = int(num[0])
else:
    x = int(num[0])
    y = int(num[1]) int(num[0])<int(num[1]) int(num[0]) int num[0] num 0 int(num[1]) int num[1] num 1 x = int(num[1]) x int(num[1]) int num[1] num 1 y = int(num[0]) y int(num[0]) int num[0] num 0 x = int(num[0]) x int(num[0]) int num[0] num 0 y = int(num[1]) y int(num[1]) int num[1] num 1 end = 0 end 0 z = x % y z x % y x y if z == 0:
    print(y)
else:
    while True:
        z1 = y % z
        y1 = z
        if z1 == 0:
            print(z)
            break 
        z = z1
        y = y1     z == 0 z 0 print(y) print y while True:
        z1 = y % z
        y1 = z
        if z1 == 0:
            print(z)
            break 
        z = z1
        y = y1     True z1 = y % z z1 y % z y z y1 = z y1 z if z1 == 0:
            print(z)
            break 
         z1 == 0 z1 0 print(z) print z break z = z1 z z1 y = y1 y y1 z1 = y % z y % z z1 y = int(num[1]) int(num[1]) y z = z1 z1 z y = y1 y1 y x = int(num[1]) int(num[1]) x y = int(num[0]) int(num[0]) y y1 = z z y1 z = x % y x % y z end = 0 0 end num = input().split() input().split() num x = int(num[0]) int(num[0]) x
num = input().split()
if int(num[0])<int(num[1]):
    x = int(num[1])
    y = int(num[0])
else:
    x = int(num[0])
    y = int(num[1])

end = 0
    
z = x % y
if z == 0:
    print(y)
else:
    while True:
        z1 = y % z
        y1 = z
        if z1 == 0:
            print(z)
            break 
        z = z1
        y = y1    