


You can only stack a box on top of another box if the dimensions of the 2-D base of the lower box ( both length and width ) are strictly larger than those of the 2-D base of the higher box.
You can rotate a box so that any side functions as its base. It is also allowed to use multiple instances of the same type of box. This means, a single type of box when rotated, will generate multiple boxes with different dimensions, which may also be included in stack building.

The height, Width, Length of the type of box will interchange after rotation.
No two boxes will have all three dimensions the same.
Don’t print anything, just return the height of the highest possible stack that can be formed.
The first line of input contains an integer ‘T’ denoting the number of test cases.
The next ‘4*T’ lines represent the ‘T’ test cases.
The first line of each test case contains an integer ‘n’, representing the number of types of boxes.
The second line of the test case contains ‘n’ space-separated integers representing elements of the array ‘height’.
The third line of the test case contains ‘n’ space-separated integers representing elements of the array ‘width’.
The fourth line of the test case contains ‘n’ space-separated integers representing elements of the array ‘length’.
Return a single integer representing the height of the highest possible stack that can be formed.
1 <= T <= 50
1 <= n <= 10^2
1 <= height[i] <= 10^2
1 <= width[i] <= 10^2
1 <= length[i] <= 10^2
Time limit: 1 second
Return the value obtained by recursive function, this will represent the height of the highest possible stack.
For any two boxes, ‘b1’ and ‘b2’ we can observe that box ‘b2’ can be placed above box ‘b1’ only if its base area is strictly less than the base area of box ‘b1’. This implies that boxes must be placed in decreasing order of base area from top to bottom in the stack. Thus if we sort all the types of boxes and their rotation in decreasing order, then the problem reduces to selecting a subsequence of boxes that forms a stack of maximum height and base dimensions of each box are strictly less than the base dimension of the box just below it. This problem is similar to Longest Increasing Subsequence using dynamic programming.