ll@t; rep(t){ ll@v,@x,p=x*v+1,r=primitiveRoot(p),a[x]; rep(i,x){ a[i]=powmod(r,v*i,p); } sortA(x,a); wt(a(x)); }