A = list(map(int,input().split()))
a=A[0]
b=A[1]
while b:
    a,b=b,a%b
print(a) A = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split a=A[0] a A[0] A 0 b=A[1] b A[1] A 1 while b:
    a,b=b,a%b b a,b=b,a%b a b b a%b a b print(a) print a a=A[0] A[0] a a,b=b,a%b b a b=A[1] A[1] b A = list(map(int,input().split())) list(map(int,input().split())) A b=b,a%b a%b b
A = list(map(int,input().split()))
a=A[0]
b=A[1]
while b:
    a,b=b,a%b
print(a)