{ int n,t; double p,w,v,gx,gy; double a,r,z,b,c,s,x,y,x1,y1; rd(n); rep(i,n){ rd(t,p,w,v,gx,gy); v+=1; a=atan2(w,v); if(a!=a)a=0; r=v*v+w*w; if(r>0){ z=0; b=1; rep(j,t)z+=b,b*=r; c=cos(-a*t); s=sin(-a*t); r=pow(r,-.5); b=pow(r,-t); x=(gx*c-gy*s-b)/z*b; y=(gx*s+gy*c-0)/z*b; c=cos(a); s=sin(a); rep(j,t){ x1=(x*c-y*s)*r; y1=(x*s+y*c)*r; wt(x=x1,y=y1); } }else{ rep(j,t-1)wt(0,0); wt(gx,gy); } } }