a,b=map(int,input().split())

x=a%b

while x>0:
	a=b
	b=x
	x=a%b

print(b) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b x=a%b x a%b a b while x>0:
	a=b
	b=x
	x=a%b x>0 x 0 a=b a b b=x b x x=a%b x a%b a b print(b) print b a=b b a b=map(int,input().split()) map(int,input().split()) b x=a%b a%b x a,b=map(int,input().split()) map(int,input().split()) a b=x x b x=a%b a%b x
a,b=map(int,input().split())

x=a%b

while x>0:
	a=b
	b=x
	x=a%b

print(b)
