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: # (x1, y1) - (x2, y2) вертикальная сторона cx = (x1 + x3) // 2 cy = (y1 + y2) // 2 else: # (x1, y1) - (x4, y4) горизонтальная сторона cx = (x1 + x2) // 2 cy = (y1 + y3) // 2 # Проверяем согласованность x и y 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))