a,b = map(int,input().split())
while a % b != 0:
	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 while a % b != 0:
	a,b = b, a % b a % b != 0 a % b a b 0 a,b = b, a % b a b b a % b a b print(b) print b b = map(int,input().split()) map(int,input().split()) b b = b, a % b a % b b a,b = map(int,input().split()) map(int,input().split()) a a,b = b, a % b b a
a,b = map(int,input().split())
while a % b != 0:
	a,b = b, a % b
print(b)