x,y = map(int,input().split(" "))

while y != 0:
    x,y=y,x%y

print(x)
 x,y = map(int,input().split(" ")) x map(int,input().split(" ")) map int input().split(" ") ().split () input split " " y while y != 0:
    x,y=y,x%y y != 0 y 0 x,y=y,x%y x y y x%y x y print(x) print x y = map(int,input().split(" ")) map(int,input().split(" ")) y x,y = map(int,input().split(" ")) map(int,input().split(" ")) x x,y=y,x%y y x y=y,x%y x%y y
x,y = map(int,input().split(" "))

while y != 0:
    x,y=y,x%y

print(x)

