x, y = map(int, input().split())
l = max(x, y)
s = min(x, y)

for i in range(x):
    olds = s
    oldl = l
    s = oldl % olds
    l = olds

    if s == 0:
        print(l)
        break x, y = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split y l = max(x, y) l max(x, y) max x y s = min(x, y) s min(x, y) min x y for i in range(x):
    olds = s
    oldl = l
    s = oldl % olds
    l = olds

    if s == 0:
        print(l)
        break i range(x) range x olds = s olds s oldl = l oldl l s = oldl % olds s oldl % olds oldl olds l = olds l olds if s == 0:
        print(l)
        break s == 0 s 0 print(l) print l break l = max(x, y) max(x, y) l s = min(x, y) min(x, y) s oldl = l l oldl s = oldl % olds oldl % olds s l = olds olds l olds = s s olds x, y = map(int, input().split()) map(int, input().split()) x y = map(int, input().split()) map(int, input().split()) y
x, y = map(int, input().split())
l = max(x, y)
s = min(x, y)

for i in range(x):
    olds = s
    oldl = l
    s = oldl % olds
    l = olds

    if s == 0:
        print(l)
        break
