#!/usr/bin/env python3 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools from math import gcd Q = int(readline()) query = readlines() def solve(q): W, H, D, Mx, My, Hx, Hy, Vx, Vy = map(int, q.split()) g = abs(gcd(Vx, Vy)) Vx //= g Vy //= g D *= g ok_x = [Mx, W + W - Mx] ok_y = [My, H + H - My] for t in range(min(D + 1, 400)): x = (Hx + t * Vx) % (W + W) y = (Hy + t * Vy) % (H + H) if x in ok_x and y in ok_y: return True return False for q in query: print('Hit' if solve(q) else 'Miss')