import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from math import gcd import itertools def mod_inv(a, b): x, y = 1, 0 while b: q, r = divmod(a, b) a, b = b, r x, y = y, x - q * y return x, a def solve_linear_mod(a, b, mod): """ solve ax = b mod""" inv_a, d = mod_inv(a, mod) if b % d != 0: return None, None a //= d b //= d mod //= d x = inv_a * b % mod return x, mod def solve(): W, H, D, Mx, My, Hx, Hy, Vx, Vy = map(int, readline().split()) d = abs(gcd(Vx, Vy)) D *= d Vx //= d Vy //= d x1, mod1 = solve_linear_mod(Vx, Mx - Hx, W + W) x2, mod2 = solve_linear_mod(Vx, W + W - Mx - Hx, W + W) x3, mod3 = solve_linear_mod(Vy, My - Hy, H + H) x4, mod4 = solve_linear_mod(Vy, H + H - My - Hy, H + H) for (x, n), (y, m) in itertools.product(((x1, mod1), (x2, mod2)), ((x3, mod3), (x4, mod4))): if x is None or y is None: continue u, mod = solve_linear_mod(n, y - x, m) if u is None: continue u %= mod t = x + n * u if t <= D: return 'Hit' return 'Miss' Q = int(readline()) for _ in range(Q): print(solve())