{"scoring":null,"notes":"In the example, the largest souvenir box that fits in each of the packing boxes has dimensions $2 \\times 4 \\times 6$. It fits in the first two packing boxes without rotation, and it can be rotated to become $2 \\times 6 \\times 4$ to fit in the third packing box.","legend":"ICPC is considering sending out contest souvenirs via a delivery service. The delivery service provides multiple types of packing boxes, each shaped as a rectangular parallelepiped.\r\n\r\nUnfortunately, there is no way to know which packing box type will be available on the shipping day, so ICPC needs to choose a souvenir box size that fits inside every packing box.\r\n\r\nAccording to the shipment rules, the souvenir box must also be a rectangular parallelepiped. When placed inside a packing box, the souvenir box may be rotated, but its sides must remain parallel to the sides of the packing box. Extra space is not an issue, as it will be filled with plastic wrap.\r\n\r\nHelp ICPC determine the maximum possible volume of a souvenir box that fits inside all of the packing boxes.","authorLogin":"tourist","language":"english","timeLimit":2000,"output":"Print the largest possible volume of a souvenir box that fits inside all of the packing boxes. Remember that the souvenir box can be rotated, as long as its sides remain parallel to the sides of the packing box.","inputFile":"stdin","outputFile":"stdout","input":"The first line contains a single integer $n$, denoting the number of packing box types provided by the delivery service ($1 \\le n \\le 1000$).\r\n\r\nThe $i$-th of the following $n$ lines contains three integers $w_i$, $h_i$, and $d_i$, denoting the width, height, and depth of the $i$-th packing box ($1 \\le w_i, h_i, d_i \\le 1000$).","authorName":"Gennady Korotkevich","sampleTests":[{"output":"48\r\n","input":"3\r\n6 5 6\r\n2 10 10\r\n3 8 4\r\n","inputFile":"example.01","outputFile":"example.01.a"}],"name":"Bounding Boxes","interaction":null,"memoryLimit":1073741824,"tutorial":"{\r\n    \\parindent=1cm\r\n    \\begin{tabular}{l@{\\extracolsep{1cm}}l}\r\n         Идея: & Георгий Корнеев\\\\\r\n         Разработка: & Георгий Корнеев\\\\\r\n     \\end{tabular}\r\n}\r\n\r\nКак проверить, что коробка $w \\times h \\times d$ помещается в коробку $w' \\times h' \\times d'$? Отсортируем размерности обеих коробок по неубыванию: $w \\le h \\le d$ и $w' \\le h' \\le d'$. Тогда первая коробка помещается во вторую, если $w \\le w'$, $h \\le h'$ и $d \\le d'$.\r\n\r\nИз этого факта следует, что решение задачи следующее. Отсортируем по возрастанию размерности каждой коробки: $w_i \\le h_i \\le d_i$. Тогда максимальная коробка, помещающаяся во все упаковочные коробки, будет иметь размеры \r\n$\\min_i w_i \\times \\min_i h_i \\times \\min_i d_i$."}