a,b = map(int,input().split())
if a<b:
	a,b = b,a
while 1:
	if a%b==0:
		break
	a,b = b,a%b
print(b) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b if a<b:
	a,b = b,a a<b a b a,b = b,a a b b a while 1:
	if a%b==0:
		break
	a,b = b,a%b 1 if a%b==0:
		break
	 a%b==0 a%b a b 0 break a,b = b,a%b a b b a%b a b print(b) print b a,b = b,a b a b = b,a a b a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b a,b = b,a%b b a b = b,a%b a%b b
a,b = map(int,input().split())
if a<b:
	a,b = b,a
while 1:
	if a%b==0:
		break
	a,b = b,a%b
print(b)