Statues X16795


Statement
 

pdf   zip

html

Michelangelo wants to bring some order to his tool shed and decides to order his statues by size. Each statue approximates a cuboid (the 3D equivalent of a rectangle) described by the dimension of each side. The size of a statue is equal to the volume of the corresponding cuboid.

Input

The input consists of several test cases. Each test case consists of a number N of statues such that 2≤ N≤ 1000, followed by N lines describing the statues. Each statue is described as id,x,y,z where id is an integer identifier and (x,y,z) is the dimensions of the cuboid, satisfying 1≤ x,y,z≤ 1000.

Output

For each test case, output the identifiers of the statues in order of increasing size. In case the size is equal, print the identifiers in increasing order. Print a blank line between each test case.

Public test cases
  • Input

    3
    1 1 2 3
    2 3 2 1
    3 1 1 2
    

    Output

    3
    1
    2
    
  • Input

    3
    4 2 4 6
    8 5 4 3
    12 7 4 1
    3
    300 100 100 100
    200 1000 100 10
    100 10 100 1000
    

    Output

    12
    4
    8
    
    100
    200
    300
    
  • Information
    Author
    Anders Jonsson
    Language
    English
    Official solutions
    Unknown.
    User solutions
    C++