from typing import List, Optional, Tuple
from axelrod._strategy_utils import detect_cycle
from axelrod.action import Action
from axelrod.player import Player
IllIIlIIllI, llIlllIlIlIllIIlIIIl = Action.C, Action.D
def lIllIIllIIIlIII(lIIllllIIlIIIlllI: List[Action]) -> bool:
    for lIIlIIlIlIIllIIll in range(len(lIIllllIIlIIIlllI) - 1):
        if lIIllllIIlIIIlllI[lIIlIIlIlIIllIIll] == lIIllllIIlIIIlllI[lIIlIIlIlIIllIIll + 1]:
            return False
    return True
class IlllIllllIIIIIIlIlI(Player):
    lIllIIIll = "strategy"
    IlllIIlIllIlI = {
        "memory_depth": float("inf"),  
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(IIlIIIIlIIllII) -> None:
        super().__init__()
        IIlIIIIlIIllII.IIIIIllIll = None  
    def IIIIllllIlI(IIlIIIIlIIllII, IlIlllIlIlIllllIII: Player) -> Action:
        if IIlIIIIlIIllII.IIIIIllIll:
            return llIlllIlIlIllIIlIIIl
        IIIIIllIll = detect_cycle(IlIlllIlIlIllllIII.lIIllllIIlIIIlllI, min_size=3)
        if IIIIIllIll:
            if len(set(IIIIIllIll)) > 1:
                IIlIIIIlIIllII.IIIIIllIll = IIIIIllIll
                return llIlllIlIlIllIIlIIIl
        return IllIIlIIllI
class IlIlIIIllIIlIlI(IlllIllllIIIIIIlIlI):
    lIllIIIll = "strategy"
    def IIIIllllIlI(IIlIIIIlIIllII, IlIlllIlIlIllllIII: Player) -> None:
        if len(IlIlllIlIlIllllIII.lIIllllIIlIIIlllI) < 10:
            return IllIIlIIllI
        if len(IlIlllIlIlIllllIII.lIIllllIIlIIIlllI) == IlIlllIlIlIllllIII.cooperations:
            return IllIIlIIllI
        if len(IlIlllIlIlIllllIII.lIIllllIIlIIIlllI) % 10 == 0:
            IIlIIIIlIIllII.IIIIIllIll = detect_cycle(IlIlllIlIlIllllIII.lIIllllIIlIIIlllI, offset=10, min_size=3)
        if IIlIIIIlIIllII.IIIIIllIll:
            return llIlllIlIlIllIIlIIIl
        else:
            return IllIIlIIllI