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