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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	private	static	BufferedReader	br = null;
	private	static	int				IX = 0;
	private	static	int				IY = 1;
	private	static	int				IZ = 2;
	private	static	double			ZR = 1e-6;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println(solve(parsePos())?"HIT":"MISS");
	}

	private static boolean solve(double[][] pos) {
		double[]	nv = getNormalVec(pos[2], pos[3], pos[4]);
		double[]	pv = new double[3];
		double		da = dot(sub(pos[2],pos[0]), nv);
		double		de = dot(sub(pos[1],pos[0]), nv);
		double		rt = da / de;

		// バリアと並行の向きに敵がいる
		if (Math.abs(de) < ZR) {
			return true;
		}

		// バリアのある平面とは逆の向きの敵がいる
		if (rt < -ZR) {
			return true;
		}

		// バリアのある平面より手前に敵がいる
		if (rt-ZR > 1.0) {
			return true;
		}

		// バリアのある平面との交点を求める
		for (int i = IX; i <= IZ; i++) {
			pv[i] = pos[0][i]*(1.0-rt)+pos[1][i]*rt;
		}

		// 交点がバリアの中にあるかチェックする
		{
			double[]	c1 = cross(sub(pos[3], pos[2]), sub(pv, pos[2]));
			double[]	c2 = cross(sub(pos[4], pos[3]), sub(pv, pos[3]));
			double[]	c3 = cross(sub(pos[2], pos[4]), sub(pv, pos[4]));
			double		d1 = dot(c1, c2);
			double		d2 = dot(c1, c3);

			if (d1 < -ZR || d2 < -ZR) {
				return true;
			}
		}

		return false;
	}

	private static double[] getNormalVec(double[] a, double[] b, double[] c) {
		double[]	ab = sub(b, a);
		double[]	ac = sub(c, a);
		double[]	n  = cross(ab, ac);

		return n;
	}
	
	private static double[] sub(double[] v1, double[] v2) {
		double[]	v3 = { v1[IX]-v2[IX], v1[IY]-v2[IY], v1[IZ]-v2[IZ] };
		return v3;
	}

	private static double[] cross(double[] v1, double[] v2) {
		double[]	v3 = { v1[IY]*v2[IZ]-v1[IZ]*v2[IY], v1[IZ]*v2[IX]-v1[IX]*v2[IZ], v1[IX]*v2[IY]-v1[IY]*v2[IX] };
		return v3;
	}

	private static double dot(double[] v1, double[] v2) {
		return v1[IX]*v2[IX]+v1[IY]*v2[IY]+v1[IZ]*v2[IZ];
	}

	private static double[][] parsePos() {
		double[][]	pos = new double[5][3];

		for (int i = 0; i < 5; i++) {
			String		str = parseStdin();
			String[]	lns = str.split(" ");

			for (int j = IX; j <= IZ; j++) {
				pos[i][j] = Double.parseDouble(lns[j]);
			}
		}

		return pos;
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
        	String  tmp = br.readLine();
        	if (tmp != null) {
            	if (!tmp.isEmpty()) {
            		stdin = tmp;
            	}
        	}
        }
        catch (IOException e) {}
 
        return stdin;
	}
}