b, a = map(int, raw_input().split(" "))
if a >= b:
    temp = b
    b = a
    a = temp

while 1:
    r = b % a
    if r == 0:
        print(a)
        break
    b = a
    a = r b, a = map(int, raw_input().split(" ")) b map(int, raw_input().split(" ")) map int raw_input().split(" ") ().split () raw_input split " " a if a >= b:
    temp = b
    b = a
    a = temp a >= b a b temp = b temp b b = a b a a = temp a temp while 1:
    r = b % a
    if r == 0:
        print(a)
        break
    b = a
    a = r 1 r = b % a r b % a b a if r == 0:
        print(a)
        break
     r == 0 r 0 print(a) print a break b = a b a a = r a r b = a a b a = map(int, raw_input().split(" ")) map(int, raw_input().split(" ")) a r = b % a b % a r b, a = map(int, raw_input().split(" ")) map(int, raw_input().split(" ")) b a = temp temp a a = r r a temp = b b temp b = a a b
b, a = map(int, raw_input().split(" "))
if a >= b:
    temp = b
    b = a
    a = temp

while 1:
    r = b % a
    if r == 0:
        print(a)
        break
    b = a
    a = r