#ALDS 1-B: Greatest Common Divisor

x = input().split()
a = int(x[0])
b = int(x[1])

while(a % b != 0):
    c = b
    b = a % b
    a = c
print(b)
 x = input().split() x input().split() ().split () input split a = int(x[0]) a int(x[0]) int x[0] x 0 b = int(x[1]) b int(x[1]) int x[1] x 1 while(a % b != 0):
    c = b
    b = a % b
    a = c a % b != 0 a % b a b 0 c = b c b b = a % b b a % b a b a = c a c print(b) print b b = a % b a % b b x = input().split() input().split() x b = int(x[1]) int(x[1]) b a = int(x[0]) int(x[0]) a a = c c a c = b b c
#ALDS 1-B: Greatest Common Divisor

x = input().split()
a = int(x[0])
b = int(x[1])

while(a % b != 0):
    c = b
    b = a % b
    a = c
print(b)

