from typing import Callable, Generic, TypeVar

T = TypeVar("T")

class SegTree(Generic[T]):
    def __init__(self, op: Callable[[T, T], T], e: T, v: int | list[T]) -> None: ...
    def set(self, p: int, x: T) -> None: ...
    def get(self, p: int) -> T: ...
    def prod(self, left: int, right: int) -> T: ...
    def all_prod(self) -> T: ...
    def max_right(self, left: int, f: Callable[[T], bool]) -> int: ...
    def min_left(self, right: int, f: Callable[[T], bool]) -> int: ...
    def _update(self, k: int) -> None: ...
