a, b = map(int, input().split())
x, y = max(a, b), min(a, b)

while 1:
    if x%y == 0:
        break
    x, y = y, x%y

print(y) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b x, y = max(a, b), min(a, b) x max(a, b) max a b y min(a, b) min a b while 1:
    if x%y == 0:
        break
    x, y = y, x%y 1 if x%y == 0:
        break
     x%y == 0 x%y x y 0 break x, y = y, x%y x y y x%y x y print(y) print y a, b = map(int, input().split()) map(int, input().split()) a x, y = max(a, b), min(a, b) max(a, b) x x, y = y, x%y y x b = map(int, input().split()) map(int, input().split()) b y = y, x%y x%y y y = max(a, b), min(a, b) min(a, b) y
a, b = map(int, input().split())
x, y = max(a, b), min(a, b)

while 1:
    if x%y == 0:
        break
    x, y = y, x%y

print(y)