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