#include using namespace std; using namespace atcoder; int main(){ int t; cin >> t; while(t--){ long long W, H, D, Mx, My, Hx, Hy, Vx, Vy, g, gx, gy, W2, H2, mx, my; cin >> W >> H >> D >> Mx >> My >> Hx >> Hy >> Vx >> Vy; g = gcd(Vx, Vy); Vx /= g, Vy /= g, D *= g; gx = gcd(Vx, 2 * W), gy = gcd(Vy, 2 * H); Vx /= gx, W2 = 2 * W / gx; Vy /= gy, H2 = 2 * H / gy; bool ans = false; for(int i = 0; i < 4; i++){ mx = (i & 1? 1: -1) * Mx - Hx; my = (i & 2? 1: -1) * My - Hy; if(mx % gx != 0 || my % gy != 0)continue; mx /= gx, my /= gy; mx *= inv_mod(Vx, W2); my *= inv_mod(Vy, H2); auto T = crt({mx, my}, {W2, H2}); if(T.second == 0)continue; if(T.first <= D)ans = true; } cout << (ans ? "Hit" : "Miss") << '\n'; } }