| def can_divide_figures(n, figures): |
| possible_x = None |
| possible_y = None |
|
|
| for figure in figures: |
| if figure[0] == 0: |
| _, r, x, y = figure |
| cx, cy = x, y |
| else: |
| _, x1, y1, x2, y2, x3, y3, x4, y4 = figure |
| |
| if x1 == x2: |
| cx = (x1 + x3) // 2 |
| cy = (y1 + y2) // 2 |
| else: |
| cx = (x1 + x2) // 2 |
| cy = (y1 + y3) // 2 |
|
|
| |
| if possible_x is None: |
| possible_x = cx |
| elif possible_x != cx: |
| possible_x = None |
|
|
| if possible_y is None: |
| possible_y = cy |
| elif possible_y != cy: |
| possible_y = None |
|
|
| if possible_x is None and possible_y is None: |
| return "No" |
|
|
| return "Yes" |
|
|
|
|
| |
| n = int(input().strip()) |
| figures = [list(map(int, input().strip().split())) for _ in range(n)] |
|
|
| |
| print(can_divide_figures(n, figures)) |