To solve this, I grouped the rectangles by sorting them based on their x or y coordinates. Then, I scanned through the sorted list to find points where I could split them into three non-overlapping groups—each with at least one rectangle and no rectangle spanning across the cut. I checked both horizontal and vertical directions, and if either allowed such a split, I returned True; if not, I returned False.
That didn't pass all the cases which is weird and didn't find why it was like that. So I checked the editiorial and saw my mistaskes.