#include using namespace std; #define rep(i,n) for(int (i) = 0 ; (i) < (int)(n) ; (i)++) #define REP(i,a,b) for(int (i) = a ; (int)(i) <= (int)(b) ; (i)++) #define all(n) (n).begin(),(n).end() typedef long long ll; typedef vector Vi; typedef vector VVi; typedef pair Pii; typedef vector VPii; typedef complex P; int canDiv(int a,int b){ if( b == 0 ) return a == 0; else return 1. * a / b >= 0; } int main(){ int Q; cin >> Q; while(Q--){ int W,H,D,Mx,My,Hx,Hy,Vx,Vy; cin >> W >> H >> D >> Hx >> Hy >> Mx >> My >> Vx >> Vy; int sx = Vx >= 0 ? +1 : -1; int sy = Vy >= 0 ? +1 : -1; for(int i = 0 ; i < 80; i++){ for(int j = 0 ; j < 80 ; j++){ int ox = sx*j * W; int oy = sy*i * H; int hx = (j % 2 ? W - Hx : Hx)+ox; int hy = (i % 2 ? H - Hy : Hy)+oy; P I = P(hx,hy) - P(Mx,My); P V(Vx,Vy); if( abs(I)/abs(V) > D + 1e-4 ) continue; P IE = I / abs(I); P VE = V / abs(V); if( abs(IE-VE) <= 1e-9 ){ cout << "Hit" << endl; goto exit; } } } cout << "Miss" << endl; exit:; } }