The caves have been completely traversed, and Mr. Benum has been located! However, the quest is not over. Swarms of bebiliths, or spider-monsters the size of elephants, are swiftly decimating the ex-convicts! It is up to Max to command the remaining ex-convicts so that they can exterminate the bebilith army. But first, Max has to ensure that the ex-convicts will stay alive!
There are bebiliths in pursuit of one of the groups of ex-convicts. Each bebilith has a speed , a venom-spitting distance and a claw sharpness (where the bebilith with the sharpest claw has the highest value of ). Meanwhile, the ex-convicts are running at a uniform speed .
If two bebiliths have the same speed and are faster or at pace with the ex-convicts, the bebilith with the sharpest claws is more dangerous. However, if two bebiliths have the same speed but are slower than the ex-convicts, the bebilith that spits venom the farthest is more dangerous. Otherwise, if two bebiliths have different speeds, the faster one is more dangerous. Max numbers each bebilith for from to . If there is a tie between two bebiliths in terms of how dangerous they are, the one that is numbered the lowest is considered more dangerous. Help Max determine what number represents the most dangerous bebilith times!
Next lines: Three space-separated integers on each line. Line represents the characteristics of the bebilith.
Next lines: A single integer on each line, indicating that the most dangerous bebilith's number should be reported back to Max.
lines of the most dangerous bebilith's number as queried.
5 4 7 29 61 7 42 59 4 1 441221001 3 7 9996999 4 1 2 3 4
1 2 3 4
Bebiliths and have the same speed, and both are the fastest. Their speed is greater than Max's speed. Bebilith has sharper claws, so it is the most dangerous, while bebilith is the most dangerous. Bebilith is faster than bebilith , so they are the and most dangerous, respectively.