Time Limit : sec, Memory Limit : KB

The Phantom

Mr. Hoge is in trouble. He just bought a new mansion, but it’s haunted by a phantom. He asked a famous conjurer Dr. Huga to get rid of the phantom. Dr. Huga went to see the mansion, and found that the phantom is scared by its own mirror images. Dr. Huga set two flat mirrors in order to get rid of the phantom.

As you may know, you can make many mirror images even with only two mirrors. You are to count up the number of the images as his assistant. Given the coordinates of the mirrors and the phantom, show the number of images of the phantom which can be seen through the mirrors.


The input consists of multiple test cases. Each test cases starts with a line which contains two positive integers, px and py (1 ≤ px, py ≤ 50), which are the x- and y-coordinate of the phantom. In the next two lines, each line contains four positive integers ux, uy, vx and vy (1 ≤ ux, uy, vx, vy ≤ 50), which are the coordinates of the mirror.

Each mirror can be seen as a line segment, and its thickness is negligible. No mirror touches or crosses with another mirror. Also, you can assume that no images will appear within the distance of 10-5 from the endpoints of the mirrors.

The input ends with a line which contains two zeros.


For each case, your program should output one line to the standard output, which contains the number of images recognized by the phantom. If the number is equal to or greater than 100, print “TOO MANY” instead.

Sample Input

4 4
3 3 5 3
3 5 5 6
4 4
3 3 5 3
3 5 5 5
0 0

Output for the Sample Input