while True:
try:
def gcd(a,b):
if a > b:
a,b = b,a
y = b % a
if y == 0:
return a
else:
a,b=b,y
return gcd(a,b)
a,b = map(int,input().split())
print(gcd(a,b))
except:
break