give n cuboid dimension ith cuboid cuboidsi widthi lengthi heighti 0indexed choose subset cuboid place otheryou place cuboid cuboid j widthi widthj lengthi lengthj heighti heightj you rearrange cuboid dimension rotate cuboidReturn maximum height stack cuboid Example 1input cuboid 504520953753452312output 190explanationcuboid 1 place 53x37 face height 95cuboid 0 place 45x20 face height 50Cuboid 2 place 23x12 face height 45The total height 95 50 45 190example 2input cuboid 38254576353output 76explanationyou can not place cuboid otherWe choose cuboid 1 rotate 35x3 face height 76example 3input cuboid 711177171111717111771771117117output 102ExplanationAfter rearrange cuboid cuboid dimensionyou place 11x7 cuboid height 17the maximum height stack cuboid 6 17 102 Constraintsn cuboidslength1 n 1001 widthi lengthi heighti 100