Beautiful Triangle

Time limit1sMemory limit128 MB

Summary
Given three vertices, classify the triangle by side lengths and by angles, or report that the points are collinear.
Level

Easy3 of 10

Topics
Geometry, Math, Implementation, Sorting
Solved
No attempts yet

Problem

Han Sam-deok is a world-renowned artist who draws beautiful triangles. His triangles captivate everyone who sees them, stopping passersby in their tracks. People believed that his triangles were something special — neither acute, right, nor obtuse, and neither equilateral nor isosceles — with mysterious side lengths and inscrutable angles.

Hui-won wants to prove that these triangles are, in fact, perfectly ordinary. To do so, she classifies each triangle by the following two criteria.

Classification by side length

  • Scalene: all three sides have different lengths.
  • Isosceles: exactly two sides have equal length.
  • Equilateral: all three sides have equal length.

Classification by angle

  • Acute: every angle is smaller than 90 degrees.
  • Right: one angle is exactly 90 degrees.
  • Obtuse: one angle is larger than 90 degrees.

Given the coordinates of a triangle's three vertices, write a program that determines its type under each of the two criteria.

Input

The input consists of several test cases. Each test case gives, on one line, the coordinates of the triangle's three vertices in the order x1 y1 x2 y2 x3 y3, each value given to three decimal places. The last line contains a single integer -1, marking the end of the input.

Inputs that would make the classification ambiguous are never given.

  • No triangle is given that is not a right triangle yet has an angle between 88 and 92 degrees (inclusive).
  • No triangle is given in which two sides of genuinely different length differ by at most 0.01. (So whenever two side lengths differ by more than that, they are certainly different.)

Output

For each test case, print on one line the side-length classification and the angle classification, separated by a single space. If the three points do not form a triangle (that is, they are collinear), print Not a Triangle instead.

Examples5

  1. Example 1

    Input
    10.000 10.000 10.000 20.000 20.000 10.000
    0.000 0.000 4.000 0.000 2.000 3.464
    -1
    
    Expected output
    Isosceles Right
    Equilateral Acute
    
  2. Example 2

    Input
    0.000 0.000 3.000 0.000 0.000 4.000
    -1
    
    Expected output
    Scalene Right
    
  3. Example 3

    Input
    0.000 0.000 5.000 0.000 1.000 4.000
    -1
    
    Expected output
    Scalene Acute
    
  4. Example 4

    Input
    0.000 0.000 5.000 0.000 1.000 1.000
    -1
    
    Expected output
    Scalene Obtuse
    
  5. Example 5

    Input
    0.000 0.000 4.000 0.000 2.000 5.000
    -1
    
    Expected output
    Isosceles Acute