def is_valid(s: str) -> bool:
    # your move