from dataclasses import InitVar, dataclass

# (a) Vehicle


@dataclass
class Vehicle:
    _seats: InitVar[int]
    _hp: InitVar[int]
    _ccm: InitVar[int]
    _weight: InitVar[int]

    def __post_init__(self, seats: int, hp: int, ccm: int, weight: int):
        assert 0 < seats < 10
        assert 0 < hp
        assert 0 < ccm
        assert 0 < weight
        self.__seats = seats
        self.__hp = hp
        self.__ccm = ccm
        self.__weight = weight

    def fun_factor(self) -> float:
        return (10 * self.__hp + self.__ccm) / self.__weight

    def __gt__(self, other: 'Vehicle') -> bool:
        return self.fun_factor() > other.fun_factor()
    
    @property
    def seats(self) -> int:
        return self.__seats
    
    @property
    def hp(self) -> int:
        return self.__hp
    
    @property
    def ccm(self) -> int:
        return self.__ccm
    
    @property
    def weight(self) -> int:
        return self.__weight

# (b) Car


@dataclass
class Car(Vehicle):
    _spoiler: InitVar[bool]
    
    def __post_init__(self, seats: int, hp: int, ccm: int, weight: int, spoiler: bool):
        super().__post_init__(seats, hp, ccm, weight)
        self.__spoiler = spoiler

    def fun_factor(self) -> float:
        return super().fun_factor() + (0.2 if self.__spoiler else 0)
    
    @property
    def has_spoiler(self) -> bool:
        return self.__spoiler


# (c) Motorcycle


@dataclass
class Motorcycle(Vehicle):
    _sidecar: InitVar[bool]

    def __post_init__(self, seats: int, hp: int, ccm: int, weight: int, sidecar: bool):
        if sidecar:
            assert 2 <= seats <= 3
        else:
            assert 1 <= seats <= 2
        super().__post_init__(seats, hp, ccm, weight)
        self.__sidecar = sidecar

    def fun_factor(self) -> float:
        return super().fun_factor() * (2.4 if self.__sidecar else 3)
    
    @property
    def is_sidecar(self) -> bool:
        return self.__sidecar