Stellar history 2005.11.5. You are about to engage an enemy spacecraft as the captain of the UAZ Advance spacecraft. Fortunately, the enemy spaceship is still unnoticed. In addition, the space coordinates of the enemy are already known, and the "feather cannon" that emits a powerful straight beam is ready to launch. After that, I just issue a launch command.

However, there is an energy barrier installed by the enemy in outer space. The barrier is triangular and bounces off the "feather cannon" beam. Also, if the beam hits the barrier, the enemy will notice and escape. If you cannot determine that you will hit in advance, you will not be able to issue a launch command.

Therefore, enter the cosmic coordinates (three-dimensional coordinates x, y, z) of the UAZ Advance, enemy, and barrier positions, and if the beam avoids the barrier and hits the enemy, "HIT", if it hits the barrier " Create a program that outputs "MISS".

However, the barrier is only for those that look like a triangle from the Advance issue, and nothing that looks like a line segment is crushed. Barriers are also valid at boundaries containing triangular vertices and shall bounce the beam. Also, if the enemy is in the barrier, output "MISS".

Constraints

* -100 ≤ x, y, z ≤ 100
* The UAZ Advance and the enemy are never in the same position.

Input

The format of the input data is as follows:

The first line is the coordinates of UAZ Advance (x, y, z) (integer, half-width space delimited)
The second line is the coordinates of the enemy (x, y, z) (integer, half-width space delimiter)
The third line is the coordinates of vertex 1 of the barrier (x, y, z) (integer, half-width space delimiter)
The fourth line is the coordinates (x, y, z) of the vertex 2 of the barrier (integer, half-width space delimiter)
The fifth line is the coordinates (x, y, z) of the vertex 3 of the barrier (integer, half-width space delimiter)

Output

Output on one line with HIT or MISS.

Examples

Input

-10 0 0
10 0 0
0 10 0
0 10 10
0 0 10


Output

HIT


Input

-10 6 6
10 6 6
0 10 0
0 10 10
0 0 10


Output

MISS
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* 3次元幾何 */

typedef double P_type;
typedef double G_real; //実数の戻り値(float or double or long double)
const G_real P_eps = 1e-8; //整数の時はゼロ

struct P3{
  P_type x, y, z;
  P3(P_type x = 0, P_type y = 0, P_type z = 0): x(x), y(y), z(z) {}

  P3 operator-() const {
    return P3(-x, -y, -z);
  }

  P3 operator+(const P3 &B) const {
    return P3(x + B.x, y + B.y, z + B.z);
  }

  P3 operator-(const P3 &B) const {
    return P3(x - B.x, y - B.y, z - B.z);
  }

  P3 operator*(P_type a) const {
    return P3(x * a, y * a, z * a);
  }

  P3 operator/(P_type a) const {
    return P3(x / a, y / a, z / a);
  }

  P3& operator+=(const P3 &B) {
    x += B.x; y += B.y; z += B.z;
    return *this;
  }

  P3& operator-=(const P3 &B) {
    x -= B.x; y -= B.y; z -= B.z;
    return *this;
  }

  P3& operator*=(P_type a) {
    x *= a; y *= a; z *= a;
    return *this;
  }

  P3& operator/=(P_type a) {
    x /= a; y /= a; z /= a;
    return *this;
  }

  bool operator<(const P3 &b){
    if (abs(x - b. x) > P_eps) return x + P_eps < b.x;
    if (abs(y - b. y) > P_eps) return y + P_eps < b.y;
    return z + P_eps < b.z;
  }
};

/* 3点a, b, cを通る平面 */
// TODO: 1直線上に並んでいる場合をError化
struct Plane {
  P3 a, b, c;

  Plane(P3 a, P3 b, P3 c): a(a), b(b), c(c) {}
};

P_type dot(P3 a, P3 b) {
  return a.x * b.x + a.y * b.y + a.z * b.z;
}

P3 cross(P3 a, P3 b) {
  P_type x = a.y * b.z - a.z * b.y;
  P_type y = a.z * b.x - a.x * b.z;
  P_type z = a.x * b.y - a.y * b.x;
  return P3(x, y, z);
}

P_type norm(P3 a) {
  return dot(a, a);
}

G_real abs(P3 a) {
  return sqrt(dot(a, a));
}

/* 直線abと点cの距離 */
G_real distanceLP(P3 a, P3 b, P3 c) {
  return abs(cross(b-a, c-a)) / abs(b-a);
}

/* 線分abと点cの距離 */
G_real distanceSP(P3 a, P3 b, P3 c) {
  if (dot(b-a, c-a) <= P_eps) return abs(c-a);
  if (dot(a-b, c-b) <= P_eps) return abs(c-b);
  return abs(cross(b-a, c-a)) / abs(b-a);
}

/* 射影(直線abとpからの垂線との交点) */
P3 getProject(P3 a, P3 b, P3 p) {
  P3 base = b - a;
  return a + base * dot(p - a, base) / norm(base);
}

/* 直線Aと直線Bの距離 */
G_real distanceLL(P3 a1, P3 a2, P3 b1, P3 b2) {
  P3 n = cross(a2 - a1, b2 - b1);
  if (abs(n) <= P_eps) return distanceLP(a1, a2, b1); //平行
  return abs(dot(n, b1 - a1)) / abs(n);
}

/* 線分Aと線分Bの距離(未検証) */
G_real distanceSS(P3 a1, P3 a2, P3 b1, P3 b2) {
  //ねじれの位置
  P3 n = cross(a2 - a1, b2 - b1);
  if (abs(n) > P_eps) { // 平行ではない
    G_real d = distanceLL(a1, a2, b1, b2);
    P3 p = n * d / abs(n);
    P3 c1 = b1 + p, c2 = b2 + p;

    P3 va = a2 - a1, vc = c2 - c1;
    bool f1 = dot(cross(va, c1 - a1), cross(va, c2 - a1)) < -P_eps;
    bool f2 = dot(cross(vc, a1 - c1), cross(vc, a2 - c1)) < -P_eps;

    if (f1 && f2) return d;
  }

  //その他
  return min({distanceSP(a1, a2, b1), distanceSP(a1, a2, b2),
              distanceSP(b1, b2, a1), distanceSP(b1, b2, a2)});
}

/* 点と平面Plの距離 */
G_real distancePPl(P3 p, P3 pl1, P3 pl2, P3 pl3) {
  P3 n = cross(pl2 - pl1, pl3 - pl1);
  return abs(dot(p - pl1, n)) / abs(n);
}

/* 直線Aと、平面Plの交点 */
vector<P3> getCrosspointLPl(P3 a1, P3 a2, P3 pl1, P3 pl2, P3 pl3) {
  P3 n = cross(pl2 - pl1, pl3 - pl1); //平面の法線ベクトル
  if (abs(dot(n, a2 - a1)) <= P_eps)
    return {}; //平面と直線が平行

  //P3 c = n * abs(dot(n, a1 - pl1)) / norm(n) + a1;
  G_real s = dot(pl1 - a1, n), t = dot(a2 - pl1, n);
  P3 c = a1 + (a2 - a1) * (s / (s + t));
  return {c};
}

vector<P3> getCrosspointSPl(P3 a1, P3 a2, P3 pl1, P3 pl2, P3 pl3) {
  auto cps = getCrosspointLPl(a1, a2, pl1, pl2, pl3);
  if (cps.empty()) return {};
  if (norm(a1 - cps[0]) > norm(a1 - a2)) return {};
  if (norm(a2 - cps[0]) > norm(a1 - a2)) return {};
  return cps;
}

P3 scan() {
  int x, y, z;
  cin >> x >> y >> z;
  return P3(x, y, z);
}

int main(){
  P3 uaz = scan();
  P3 enemy = scan();
  P3 t1 = scan(), t2 = scan(), t3 = scan();

  auto cps = getCrosspointSPl(uaz, enemy, t1, t2, t3);

  if (cps.empty()) {
    puts("HIT");
    return 0;
  }

  P3 cp = cps[0];

  double area = 0;
  area += abs(cross(t1 - cp, t2 - cp));
  area += abs(cross(t2 - cp, t3 - cp));
  area += abs(cross(t3 - cp, t1 - cp));
  area -= abs(cross(t1 - t3, t2 - t3));

  if (abs(area) <= P_eps) {
    puts("MISS");
  } else {
    puts("HIT");
  }

  return 0;
}

