while True: try: n,m=map(int,input().strip().split(' ')) #print(n,m) min_num=min(n,m) re=0 for i in range(1,min_num+1): if n%i==0 and m%i==0: if i>re: re=i print(re) except: break while True: try: n,m=map(int,input().strip().split(' ')) #print(n,m) min_num=min(n,m) max_num=max(n,m) while min_num!=0: temp=max_num%min_num max_num=min_num min_num=temp print(max_num) except: break