Before Kiana travels to the moon, she must take a subway to bid farewell to her friends. However, an unexpected challenge arises: she must construct the subway herself.
Kiana's task is to build a cuboid subway with dimensions $$$w \times h \times l$$$. Prior to building the subway, she must create a time-stasis field of the same size. In her form as the Herrscher of Finality, Kiana can generate non-intersecting cuboid spaces, which can then be assembled to create the required field.
However, there are constraints on the small spaces: each cuboid space must have at least one face that is a square. In other words, if the dimensions of the cuboid space are $$$a \times b \times c$$$, then at least one of the following conditions must hold: $$$a=b, b=c$$$, or $$$a=c$$$.
Since Kiana's power is limited, she seeks your assistance as captain to develop a plan to accomplish the task.
A single line containing three integers $$$w, h, l$$$ ($$$1\le w,h,l \le 10^9$$$), representing the dimensions of the required field. You can envision this field as a cuboid with the lower left corner at $$$(0,0,0)$$$ and the upper right corner at $$$(w,h,l)$$$.
The first line contains an integer $$$n$$$ ($$$1\le n \le 10^5$$$), representing the number of spaces generated.
Each of the next $$$n$$$ lines contains $$$6$$$ integers $$$x_l, y_l, z_l, x_r, y_r, z_r$$$ ($$$0 \leq x_l \lt x_r \leq w$$$, $$$0 \leq y_l \lt y_r \leq h$$$, $$$0 \leq z_l \lt z_r \leq l$$$), representing a cuboid space with its lower left corner at $$$(x_l,y_l,z_l)$$$ and upper right corner at $$$(x_r,y_r,z_r)$$$.
Your solution must ensure that no two spaces intersect and that all spaces fit together to form the required field precisely.
3 5 7
4 0 0 0 3 3 7 0 3 0 2 5 7 2 3 0 3 4 7 2 4 0 3 5 7
| Name |
|---|


