CF335D Rectangles and Square

Description

You are given $ n $ rectangles, labeled 1 through $ n $ . The corners of rectangles have integer coordinates and their edges are parallel to the $ Ox $ and $ Oy $ axes. The rectangles may touch each other, but they do not overlap (that is, there are no points that belong to the interior of more than one rectangle). Your task is to determine if there's a non-empty subset of the rectangles that forms a square. That is, determine if there exists a subset of the rectangles and some square for which every point that belongs to the interior or the border of that square belongs to the interior or the border of at least one of the rectangles in the subset, and every point that belongs to the interior or the border of at least one rectangle in the subset belongs to the interior or the border of that square.

Input Format

N/A

Output Format

N/A

Explanation/Hint

The first test case looks as follows: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF335D/b555a1b2f0fa9850a908273e7c5806edefd08e25.png)Note that rectangles 6, 8, and 9 form a square as well, and would be an acceptable answer. The second test case looks as follows: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF335D/50fe7d9330ec3e3fa026a900ee9c84c7d3b58755.png)