# coding=utf-8

a, b = map(int, input().split())
if a > b:
    big_num = a
    sml_num = b
else:
    big_num = b
    sml_num = a

while True:
    diviser = big_num % sml_num
    if diviser == 0:
        break
    else:
        big_num = sml_num
        sml_num = diviser

print(sml_num) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b if a > b:
    big_num = a
    sml_num = b
else:
    big_num = b
    sml_num = a a > b a b big_num = a big_num a sml_num = b sml_num b big_num = b big_num b sml_num = a sml_num a while True:
    diviser = big_num % sml_num
    if diviser == 0:
        break
    else:
        big_num = sml_num
        sml_num = diviser True diviser = big_num % sml_num diviser big_num % sml_num big_num sml_num if diviser == 0:
        break
    else:
        big_num = sml_num
        sml_num = diviser diviser == 0 diviser 0 break big_num = sml_num big_num sml_num sml_num = diviser sml_num diviser print(sml_num) print sml_num sml_num = diviser diviser sml_num sml_num = a a sml_num big_num = sml_num sml_num big_num diviser = big_num % sml_num big_num % sml_num diviser sml_num = b b sml_num big_num = b b big_num b = map(int, input().split()) map(int, input().split()) b big_num = a a big_num a, b = map(int, input().split()) map(int, input().split()) a
# coding=utf-8

a, b = map(int, input().split())
if a > b:
    big_num = a
    sml_num = b
else:
    big_num = b
    sml_num = a

while True:
    diviser = big_num % sml_num
    if diviser == 0:
        break
    else:
        big_num = sml_num
        sml_num = diviser

print(sml_num)