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

while a%b != 0:
    temp = a
    a = b
    b = temp%b

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

while a%b != 0:
    temp = a
    a = b
    b = temp%b

print(b)