You are given triangles, specifically, their sides , and . Print them in the same style but sorted by their areas from the smallest one to the largest one. It is guaranteed that all the areas are different.
The best way to calculate a area of a triangle with sides , and is Heron's formula:
where .
Input Format
The first line of each test file contains a single integer . lines follow with three space-separated integers, , and .
Constraints
- , and
Output Format
Print exactly lines. On each line print space-separated integers, the , and of the corresponding triangle.
Sample Input 0
3
7 24 25
5 12 13
3 4 5
Sample Output 0
3 4 5
5 12 13
7 24 25
Explanation 0
The square of the first triangle is . The square of the second triangle is . The square of the third triangle is . So the sorted order is the reverse one.
SOLUTION:
No comments:
Post a Comment