Paint by Rectangles
문제
After her previous artwork was met with critical acclaim, Bessie was offered a job designing painting sets. She designs these paintings by choosing axis-aligned rectangles in the plane such that no two edges are collinear. The boundaries of these rectangles define the boundaries of the painting's colored regions.
Still being an avant-garde artist, Bessie decides that the painting should resemble a Holstein cow. More specifically, each region formed by the rectangles is colored either black or white, no two adjacent regions have the same color, and the region outside of all the rectangles is colored white.
After choosing the rectangles, Bessie would like you to output one of two things based on a parameter :
- If , output the total number of regions.
- If , output the number of white regions followed by the number of black regions.
입력
The first line contains and .
The next lines each contain the description of a rectangle in the form where and . and are the bottom left and top right corners of the rectangle respectively.
It is guaranteed that all the form a permutation of , and the same holds for all the .
출력
A single integer if , otherwise two separated by spaces.예제
예제 1
2 1 1 1 3 3 2 2 4 4
4
예제 2
5 2 1 5 3 6 5 4 7 9 4 1 8 3 9 8 10 10 2 2 6 7
4 5