So I want to get how does it work, not just code without comments
There are two boxes on the table. The first box has a size of X1 x Y1 x Z1, and the second box has a size of X2 x Y2 x Z2. You need to determine which box can be put inside another box. You can rotate both boxes as you want.
Input contains two lines.
The first line contains numbers X1, Y1, Z1, the second line contains numbers X2, Y2, Z2. All numbers are integers and greater than 0.
If the sizes of the boxes are equal, output "Box 1 = Box 2".
If the first box can be put inside the second box, output "Box 1 < Box 2".
If the second box can be put inside the first box, output "Box 1 > Box 2".
If none of the boxes can be put inside the other box, output "Incomparable".
But Carey's suggestion assumes a limited version of "rotate". For example a 14x1x1 box can fit inside an 11x11x1 box if you rotate it correctly. Given that version of "rotate", this is not at all easy.
Interesting observation. I see you're thinking outside the box.
I would be surprised if that was what the framers of the question had in mind but the link to the problem has timed out and is no longer available to verify. If your theory is correct, then yes, that would be a pretty sticky problem to solve and would be beyond my geometry skills.
I have the feeling that the full three-dimensional version of my theory is an unsolved mathematical problem -- at least I sort of recall reading that figuring out whether a given rectangular block can be moved around a corner in a given rectangular corridor is unsolved, which is probably more complicated. So I think that your simpler theory is the one meant to be solved.
In general, it is easier to solve if you rotate both boxed so that they lie flat in the x-y plane, where it is easier to calculate the volume of each. Then see if the one with the smaller volume will fit in the larger box.