from typing import List, Optional, Tuple
from axelrod._strategy_utils import detect_cycle
from axelrod.action import Action
from axelrod.player import Player
IIlIllllIIllIllllIl, lllIlllIIIIlIlIlIIl = Action.C, Action.D
def lIIllIIIlIIlIII(IlllIlllIlllIIIllII: List[Action]) -> bool:
    for lIIIIIIlIllIllIlI in range(len(IlllIlllIlllIIIllII) - 1):
        if IlllIlllIlllIIIllII[lIIIIIIlIllIllIlI] == IlllIlllIlllIIIllII[lIIIIIIlIllIllIlI + 1]:
            return False
    return True
class llllllllIIIllllI(Player):
    IllllIIIlIlIIlIIIIll = "strategy"
    llllIlIllllI = {
        "memory_depth": float("inf"),  
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(llllIllllIIIIllI) -> None:
        llllIllllIIIIllI.IlIIIllllllIII = 0
        llllIllllIIIIllI.llIlIlIlI = 0
        super().__init__()
    def lIlllIIIIIIIIl(llllIllllIIIIllI, llllllllIllIIIllI: Player) -> Action:
        if len(llllIllllIIIIllI.IlllIlllIlllIIIllII) > 1:
            if llllIllllIIIIllI.IlllIlllIlllIIIllII[-2] == IIlIllllIIllIllllIl and llllllllIllIIIllI.IlllIlllIlllIIIllII[-1] == IIlIllllIIllIllllIl:
                llllIllllIIIIllI.IlIIIllllllIII += 1
            if llllIllllIIIIllI.IlllIlllIlllIIIllII[-2] == lllIlllIIIIlIlIlIIl and llllllllIllIIIllI.IlllIlllIlllIIIllII[-1] == lllIlllIIIIlIlIlIIl:
                llllIllllIIIIllI.llIlIlIlI += 1
        IIlIIlIIllIIIll = len(llllIllllIIIIllI.IlllIlllIlllIIIllII)
        if IIlIIlIIllIIIll > 10:
            IIIlllIlIIlllIlllIIl = []
            if llllIllllIIIIllI.cooperations > 5:
                IIIlllIlIIlllIlllIIl.append(llllIllllIIIIllI.IlIIIllllllIII / llllIllllIIIIllI.cooperations)
            if llllIllllIIIIllI.defections > 5:
                IIIlllIlIIlllIlllIIl.append(llllIllllIIIIllI.llIlIlIlI / llllIllllIIIIllI.defections)
            if IIIlllIlIIlllIlllIIl and all(
                [abs(llllIlIlIlllII - 0.5) < 0.25 for llllIlIlIlllII in IIIlllIlIIlllIlllIIl]
            ):
                return lllIlllIIIIlIlIlIIl
        return IIlIllllIIllIllllIl