# Path: siebenapp/domain.py
# class Graph:
#     """Base interface definition"""
# 
#     NO_VALUE = "no value"
# 
#     def __init__(self, goaltree=None):
#         self.goaltree: Graph = goaltree
# 
#     def __getattr__(self, item):
#         """When method is not found, ask nested goaltree for it"""
#         if self.goaltree != self:
#             return getattr(self.goaltree, item)
#         return None
# 
#     def accept(self, command: Command) -> None:
#         """React on the given command"""
#         method_name = "accept_" + command.__class__.__name__
#         if method := getattr(self, method_name):
#             method(command)
#         elif parent := self.goaltree:
#             parent.accept(command)
#         else:
#             raise NotImplementedError(f"Cannot find method {method_name}")
# 
#     def accept_all(self, *commands: Command) -> None:
#         """React on the command chain"""
#         for command in commands:
#             self.accept(command)
# 
#     def settings(self, key: str) -> Any:
#         """Returns given inner value by the key"""
#         if self.goaltree is not None:
#             return self.goaltree.settings(key)
#         return Graph.NO_VALUE
# 
#     def reconfigure_from(self, origin: "Graph") -> None:
#         """Synchronize *non-persistent* settings from the given origin"""
#         if self.goaltree:
#             self.goaltree.reconfigure_from(origin)
# 
#     def selections(self) -> Set[int]:
#         """Return ids of special 'selection' goals"""
#         if self.goaltree:
#             return self.goaltree.selections()
#         raise NotImplementedError
# 
#     def events(self) -> deque:
#         """Returns queue of applied actions.
#         Note: this queue is modifiable -- you may push new events into it. But this
#         behavior may be changed in future."""
#         if self.goaltree is not None:
#             return self.goaltree.events()
#         raise NotImplementedError
# 
#     def q(self, keys: str = "name") -> Dict[int, Any]:
#         """Run search query against content"""
#         raise NotImplementedError
# 
#     def error(self, message: str) -> None:
#         """Show error message"""
#         if self.goaltree is not None:
#             self.goaltree.error(message)
# 
#     def verify(self) -> bool:
#         """Check all inner data for correctness"""
#         if self.goaltree is not None:
#             return self.goaltree.verify()
#         return False
# 
# class EdgeType(IntEnum):
#     BLOCKER = 1
#     PARENT = 2


from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Tuple, Union, Any, Set, Optional, Protocol
from siebenapp.domain import Graph, EdgeType
        return Point(int(self.x / divisor), int(self.y / divisor))

    def __repr__(self):
        return f"<{self.x}, {self.y}>"

    def as_tuple(self):
        return self.x, self.y


class GeometryProvider(Protocol):
    def top_left(self, row, col):
        raise NotImplementedError

    def top_right(self, row, col):
        raise NotImplementedError

    def bottom_left(self, row, col):
        raise NotImplementedError

    def bottom_right(self, row, col):
        raise NotImplementedError


def safe_average(items: List[int]) -> int:
    return int(sum(items) / len(items)) if items else 0


class Renderer:
    DEFAULT_WIDTH = 4


# Path: siebenapp/domain.py
# class Graph:
#     """Base interface definition"""
# 
#     NO_VALUE = "no value"
# 
#     def __init__(self, goaltree=None):
#         self.goaltree: Graph = goaltree
# 
#     def __getattr__(self, item):
#         """When method is not found, ask nested goaltree for it"""
#         if self.goaltree != self:
#             return getattr(self.goaltree, item)
#         return None
# 
#     def accept(self, command: Command) -> None:
#         """React on the given command"""
#         method_name = "accept_" + command.__class__.__name__
#         if method := getattr(self, method_name):
#             method(command)
#         elif parent := self.goaltree:
#             parent.accept(command)
#         else:
#             raise NotImplementedError(f"Cannot find method {method_name}")
# 
#     def accept_all(self, *commands: Command) -> None:
#         """React on the command chain"""
#         for command in commands:
#             self.accept(command)
# 
#     def settings(self, key: str) -> Any:
#         """Returns given inner value by the key"""
#         if self.goaltree is not None:
#             return self.goaltree.settings(key)
#         return Graph.NO_VALUE
# 
#     def reconfigure_from(self, origin: "Graph") -> None:
#         """Synchronize *non-persistent* settings from the given origin"""
#         if self.goaltree:
#             self.goaltree.reconfigure_from(origin)
# 
#     def selections(self) -> Set[int]:
#         """Return ids of special 'selection' goals"""
#         if self.goaltree:
#             return self.goaltree.selections()
#         raise NotImplementedError
# 
#     def events(self) -> deque:
#         """Returns queue of applied actions.
#         Note: this queue is modifiable -- you may push new events into it. But this
#         behavior may be changed in future."""
#         if self.goaltree is not None:
#             return self.goaltree.events()
#         raise NotImplementedError
# 
#     def q(self, keys: str = "name") -> Dict[int, Any]:
#         """Run search query against content"""
#         raise NotImplementedError
# 
#     def error(self, message: str) -> None:
#         """Show error message"""
#         if self.goaltree is not None:
#             self.goaltree.error(message)
# 
#     def verify(self) -> bool:
#         """Check all inner data for correctness"""
#         if self.goaltree is not None:
#             return self.goaltree.verify()
#         return False
# 
# class EdgeType(IntEnum):
#     BLOCKER = 1
#     PARENT = 2


# Path: siebenapp/render.py
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Tuple, Union, Any, Set, Optional, Protocol
from siebenapp.domain import Graph, EdgeType

        return Point(int(self.x / divisor), int(self.y / divisor))

    def __repr__(self):
        return f"<{self.x}, {self.y}>"

    def as_tuple(self):
        return self.x, self.y


class GeometryProvider(Protocol):
    def top_left(self, row, col):
        raise NotImplementedError

    def top_right(self, row, col):
        raise NotImplementedError

    def bottom_left(self, row, col):
        raise NotImplementedError

    def bottom_right(self, row, col):
        raise NotImplementedError


def safe_average(items: List[int]) -> int:
    return int(sum(items) / len(items)) if items else 0


class Renderer:
    DEFAULT_WIDTH = 4


    def __init__(self, goals: Graph, width_limit=DEFAULT_WIDTH) -> None: