Statues

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 NN of statues such that 2N10002\leq N\leq 1000, followed by NN lines describing the statues. Each statue is described as id,x,y,zid,x,y,z where idid is an integer identifier and (x,y,z)(x,y,z) is the dimensions of the cuboid, satisfying 1x,y,z10001\leq x,y,z\leq 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.

Problem information

Author: Anders Jonsson

Generation: 2026-01-25T13:57:51.103Z

© Jutge.org, 2006–2026.
https://jutge.org