require 'matrix'

vs = 5.times.map { Vector.elements gets.split.map(&:to_f), false }
x, y, z = Matrix.columns([vs[3] - vs[2], vs[4] - vs[2], vs[0] - vs[1]]).lup.solve(vs[0] - vs[2]).to_a
puts z <= 1 && (0 <= x && x <= 1 && 0 <= y && y <= 1 && x + y <= 1) ? 'MISS' : 'HIT'