r=raw_input r() while r(): a=0 for b in map(int,r().split()): while b:a,b=b,a%b print a