def gcd(a,b):
if a%b==0:
return b
else:
return gcd(b,a%b)
def main():
while True:
try:
a,b=map(int,input().split())
ans=gcd(a,b)
print(ans)
except EOFError:
break
main()
a,b=map(int,input().split())
測資中有空白行,所以會出錯