Shoring Up the Levees

Time limit1sMemory limit128 MB

Problem

The tiny country of Waterlogged is protected by a ring of levees that form a convex quadrilateral, as shown below.

The quadrilateral is given by its four corner vertices. Two more levees run along the diagonals of the quadrilateral; together with the outer ring they divide the country into four triangular quadrants. Each quadrant is named by the pair of neighbouring vertices on its outer edge — for example, the quadrant shown below has its outer edge between $(x_1,y_1)$ and $(x_2,y_2)$.

Because the two diagonals cross at a single interior point, the quadrant on a given outer edge is exactly the triangle bounded by that outer edge and the two diagonal segments running from its two endpoints to the crossing point.

Waterlogged floods often, so its levees must be reinforced, but the country is poor and has limited resources. It wants to reinforce the quadrants in order of area: the largest area first, then the second largest, then the third, and the smallest last. For each quadrant, from largest area to smallest, report that quadrant's area and the total length of the levees around it (its perimeter).

Input

The input contains several data sets. Each data set is a single line of eight real numbers:

X1 Y1 X2 Y2 X3 Y3 X4 Y4

giving the four vertices in order. The four points are guaranteed to form a convex quadrilateral in this order — no concave corners and no crossing edges. Every number lies in the range $-1000.0$ to $1000.0$ inclusive. No quadrant has an area or a perimeter smaller than $0.001$. The input ends with a line of eight $0.0$ values, which is not processed.

Output

For each data set, print a single line of eight real numbers:

A1 P1 A2 P2 A3 P3 A4 P4

where $A_k$ and $P_k$ are the area and perimeter of the $k$-th quadrant. List the quadrants from largest area to smallest, so $A_1$ is the largest area. If two quadrants have the same area after rounding to three decimal places, print the one with the larger perimeter first. Print every value rounded to exactly three decimal places, separated by single spaces. Do not print any blank lines between outputs.