from collections import defaultdict
from axelrod.action import Action
from axelrod.player import Player
IIIIllIlIlIlllIIIIII, IlIIIIII = Action.C, Action.D
class IIlllIIIIlIIII(Player):
    llIIIIlllIII = "strategy"
    llIIlIlIIlIlllll = {
        "memory_depth": float("inf"),  
        "stochastic": False,
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(
        IlIlllIlIIIll, llIIIlIlI: float = 0.1, lllIIIllIlllI: int = 20
    ) -> None:
        super().__init__()
        IlIlllIlIIIll.llIIIIlI = False
        IlIlllIlIIIll.lIlIlIIlIlIIlIl = 0
        IlIlllIlIIIll.llIIIlIlI = llIIIlIlI
        IlIlllIlIIIll.lllIIIllIlllI = lllIIIllIlllI
        IlIlllIlIIIll.lIIlllllIlIll = defaultdict(int)  
    def IIllllIlIlIlIl(IlIlllIlIIIll, lIlIIIlllIlIlllII: Player) -> Action:
        if len(IlIlllIlIIIll.history):
            lIlIIIllIIII = (IlIlllIlIIIll.history[-1], lIlIIIlllIlIlllII.history[-1])
            IlIlllIlIIIll.lIIlllllIlIll[lIlIIIllIIII] += 1
        IIlIIIIIlllIll = IlIlllIlIIIll.lIIlllllIlIll[(IIIIllIlIlIlllIIIIII, IlIIIIII)]
        IIIlllllIll = IlIlllIlIIIll.lIIlllllIlIll[(IlIIIIII, IIIIllIlIlIlllIIIIII)]
        if IIlIIIIIlllIll > IIIlllllIll * IlIlllIlIIIll.llIIIlIlI:
            IlIlllIlIIIll.llIIIIlI = True
        else:
            IlIlllIlIIIll.llIIIIlI = False
            IlIlllIlIIIll.lIlIlIIlIlIIlIl = 0
        if IlIlllIlIIIll.llIIIIlI:
            if IlIlllIlIIIll.lIlIlIIlIlIIlIl < IlIlllIlIIIll.lllIIIllIlllI:
                IlIlllIlIIIll.lIlIlIIlIlIIlIl += 1
                return IlIIIIII
            else:
                IlIlllIlIIIll.lIlIlIIlIlIIlIl = 0
                IlIlllIlIIIll.llIIIIlI = False
        return IIIIllIlIlIlllIIIIII