from collections import defaultdict
from axelrod.action import Action
from axelrod.player import Player
IlIlIIIlIlIIIlIIIll, IlIlIllIIIllll = Action.C, Action.D
class IllIIlIlIlIlllIlll(Player):
    IIllllIIIll = "strategy"
    lllIlIlIlII = {
        "memory_depth": float("inf"),  
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(
        IIlllIIIlIlIl, llllIlIlIllIIIlI: float = 0.1, IlIlllIlIllIllI: int = 20
    ) -> None:
        super().__init__()
        IIlllIIIlIlIl.llIIIlllIIllIllllIl = False
        IIlllIIIlIlIl.IllIlIIIlllI = 0
        IIlllIIIlIlIl.llllIlIlIllIIIlI = llllIlIlIllIIIlI
        IIlllIIIlIlIl.IlIlllIlIllIllI = IlIlllIlIllIllI
        IIlllIIIlIlIl.lIIlIIIllllllIIl = defaultdict(int)  
    def IlIIIIIIl(IIlllIIIlIlIl, llIlIIII: Player) -> Action:
        if len(IIlllIIIlIlIl.history):
            lllIlIllIlIllll = (IIlllIIIlIlIl.history[-1], llIlIIII.history[-1])
            IIlllIIIlIlIl.lIIlIIIllllllIIl[lllIlIllIlIllll] += 1
        IIlllIlllIlllIllIl = IIlllIIIlIlIl.lIIlIIIllllllIIl[(IlIlIIIlIlIIIlIIIll, IlIlIllIIIllll)]
        lIIlIIIlIllIlIIII = IIlllIIIlIlIl.lIIlIIIllllllIIl[(IlIlIllIIIllll, IlIlIIIlIlIIIlIIIll)]
        if IIlllIlllIlllIllIl > lIIlIIIlIllIlIIII * IIlllIIIlIlIl.llllIlIlIllIIIlI:
            IIlllIIIlIlIl.llIIIlllIIllIllllIl = True
        else:
            IIlllIIIlIlIl.llIIIlllIIllIllllIl = False
            IIlllIIIlIlIl.IllIlIIIlllI = 0
        if IIlllIIIlIlIl.llIIIlllIIllIllllIl:
            if IIlllIIIlIlIl.IllIlIIIlllI < IIlllIIIlIlIl.IlIlllIlIllIllI:
                IIlllIIIlIlIl.IllIlIIIlllI += 1
                return IlIlIllIIIllll
            else:
                IIlllIIIlIlIl.IllIlIIIlllI = 0
                IIlllIIIlIlIl.llIIIlllIIllIllllIl = False
        return IlIlIIIlIlIIIlIIIll
class lIlIIIlIlIl(IllIIlIlIlIlllIlll):
    IIllllIIIll = "strategy"
    def __init__(
        IIlllIIIlIlIl, llllIlIlIllIIIlI: float = 0.05, IlIlllIlIllIllI: int = 20
    ) -> None:
        super().__init__(
            llllIlIlIllIIIlI=llllIlIlIllIIIlI,
            IlIlllIlIllIllI=IlIlllIlIllIllI,
        )