#include #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int q; cin>>q; rep(_,q){ int w,h,d,sx,sy,gx,gy,vx,vy; cin>>w>>h>>d>>gx>>gy>>sx>>sy>>vx>>vy; int g=gcd(vx,vy); d*=g; vx/=g; vy/=g; bool vis[30][30]={}; int x=sx,y=sy; while(d>0 && !vis[y][x]){ vis[y][x]=true; y=(y+vy)%(2*h); if(y<0) y+=2*h; x=(x+vx)%(2*w); if(x<0) x+=2*w; d--; } puts(vis[gy][gx] ||vis[gy][(2*w-gx)%(2*w)] ||vis[(2*h-gy)%(2*h)][gx] ||vis[(2*h-gy)%(2*h)][(2*w-gx)%(2*w)]?"Hit":"Miss"); } return 0; }