v,i,x,y,c;g(p,q){v=q?g(q,p%q):abs(p);}main(w,h,d,p,q,r,s,t,u){if(~scanf("%d",&u)){if(c%9==!c++)for(g(t,u),w*=2,h*=2;x=abs(r+=t/v)%w,y=abs(s+=u/v)%h,++i<999&&(x-p&&w-x-p||y-q&&h-y-q)||!puts(i>d*v|i>998?"Miss":"Hit"););main(h,d,p,q,r,s,t,u);}}