from typing import List, Optional
from axelrod.action import Action
from axelrod.player import Player
lllIIlIllllIll = List[float]
IIIIlIIIlIIll, lIllllIIlI = Action.C, Action.D
class llIIlIlIlIlllIlIl(Player):
    IllIIlIllI = "strategy"
    IlIIllIIlIlIIl = {
        "stochastic": False,
        "memory_depth": float("inf"),
        "long_run_time": False,
        "inspects_source": False,
        "manipulates_source": False,
        "manipulates_state": False,
    }
    def __init__(IlllIllIllI) -> None:
        super().__init__()
        IlllIllIllI.IIllIIlIllllIlllllll = [
            IIIIlIIIlIIll,
            IIIIlIIIlIIll,
            lIllllIIlI,
            IIIIlIIIlIIll,
            lIllllIIlI,
            lIllllIIlI,
            lIllllIIlI,
            IIIIlIIIlIIll,
            IIIIlIIIlIIll,
            lIllllIIlI,
            IIIIlIIIlIIll,
            lIllllIIlI,
            IIIIlIIIlIIll,
            IIIIlIIIlIIll,
            lIllllIIlI,
            IIIIlIIIlIIll,
            lIllllIIlI,
            lIllllIIlI,
            IIIIlIIIlIIll,
            lIllllIIlI,
        ]
        IlllIllIllI.lIIlIlllIlIllIllII = 0
        IlllIllIllI.lIllIlIIIl = 0
        IlllIllIllI.lllIIlIIIIIIlIIll = False
    def lIIIIIlIIIlIIIII(IlllIllIllI, llllllIIllllllllllI: Player) -> Action:
        if not IlllIllIllI.history:
            return IlllIllIllI.IIllIIlIllllIlllllll[0]
        llIIIlIIlllIlllI = len(IlllIllIllI.history)
        if llIIIlIIlllIlllI < len(IlllIllIllI.IIllIIlIllllIlllllll):
            if llllllIIllllllllllI.history[-1] == lIllllIIlI:
                if IlllIllIllI.history[-1] == lIllllIIlI:
                    IlllIllIllI.lIIlIlllIlIllIllII += 1
                if IlllIllIllI.history[-1] == IIIIlIIIlIIll:
                    IlllIllIllI.lIllIlIIIl += 1
            return IlllIllIllI.IIllIIlIllllIlllllll[llIIIlIIlllIlllI]
        if llIIIlIIlllIlllI == len(IlllIllIllI.IIllIIlIllllIlllllll):
            llIIIllllllllI = abs(IlllIllIllI.lIIlIlllIlIllIllII - IlllIllIllI.lIllIlIIIl)
            IlllIllIllI.lllIIlIIIIIIlIIll = llIIIllllllllI <= 2
        if IlllIllIllI.lllIIlIIIIIIlIIll:
            return lIllllIIlI
        if not IlllIllIllI.lllIIlIIIIIIlIIll:
            if llIIIlIIlllIlllI < len(IlllIllIllI.IIllIIlIllllIlllllll) + 5:
                return IIIIlIIIlIIll
            return lIllllIIlI if llllllIIllllllllllI.history[-1] == lIllllIIlI else IIIIlIIIlIIll