{ll@t;REP(t){ll@n,p,d[1d3];REP[d](j,Factor(p=n=2n-1,d))p-=p/j;rep[d](j,Divisor(p,d))if(powmod(2,j,n)==1%n)wt(p=j);}}