import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines import math import itertools def inv(a, mod): b, x, y=mod, 1, 0 while b: t=a//b a-=t*b x-=t*y a, b=b, a x, y=y, x return x%mod q=int(readline()) for _ in range(q): w, h, d, mx, my, hx, hy, vx, vy=map(int, readline().split()) if vx<0: vx=-vx hx, mx=w-hx, w-mx if vy<0: vy=-vy hy, my=h-hy, h-my ok=False a=2*h*vx b=2*w*vy g=math.gcd(a, b) a//=g b//=g for cx, cy in itertools.product((mx, 2*w-mx), (my, 2*h-my)): c=(cx-hx)*vy-(cy-hy)*vx if c%g!=0: continue c//=g if b: r=inv(a, b)*c%b x1=-2*h*r-cy+hy if (x1+2*h*b-1)//(2*h*b)<=(x1+d*vy)//(2*h*b): print("Hit") break else: s=inv(b, a)*c%a x1=-2*w*s-cx+hx if (x1+2*w*a-1)//(2*w*a)<=(x1+d*vx)//(2*w*a): print("Hit") break else: print("Miss")