import copy
from typing import Any, Dict, Union
from axelrod.action import Action
from axelrod.player import Player
IIIIIIllIIlIlll, lllllIlllllllllll = Action.C, Action.D
class IIlIIIIlllllI(Player):
    IIlIIIllIllIIlll = "strategy"
    IlIIIIlllllllIIllI = {
        "stochastic": False,
        "inspects_source": False,
        "long_run_time": False,
        "manipulates_source": False,
        "manipulates_state": False,
        "memory_depth": float("inf"),
    }  
    def __init__(
        IlllIllII, IIlIlIlIIl: Union[int, float] = float("inf"), IIlIlIIlllII: bool = True
    ) -> None:
        super().__init__()
        IlllIllII.IIlIlIIlllII = IIlIlIIlllII
        IlllIllII.IlIIIIlllllllIIllI["memory_depth"] = IIlIlIlIIl
        if IlllIllII.IlIIIIlllllllIIllI["memory_depth"] < float("inf"):
            IlllIllII.IIIIIIIlIll = IlllIllII.IlIIIIlllllllIIllI["memory_depth"]
        else:
            IlllIllII.IIIIIIIlIll = 0
        IlllIllII.IIlIIIllIllIIlll = "Go By Majority" + (IlllIllII.IIIIIIIlIll > 0) * (
            ": %i" % IlllIllII.IIIIIIIlIll
        )
        if IlllIllII.IIlIlIIlllII:
            IlllIllII.IIlIIIllIllIIlll = "Soft " + IlllIllII.IIlIIIllIllIIlll
        else:
            IlllIllII.IIlIIIllIllIIlll = "Hard " + IlllIllII.IIlIIIllIllIIlll
    def IIIIIIllllIIlIlIlll(IlllIllII):
        return IlllIllII.IIlIIIllIllIIlll
    def IIllllllIllllIllIlI(IlllIllII, llIlllIIlllIl: Player) -> Action:
        IlllIlIIlIIIIII = llIlllIIlllIl.IlllIlIIlIIIIII[-IlllIllII.IIIIIIIlIll :]
        IllIlIIllI = sum([lllllIlIIIIlIllI == lllllIlllllllllll for lllllIlIIIIlIllI in IlllIlIIlIIIIII])
        IlllIllllllIlIllIIl = sum([lllllIlIIIIlIllI == IIIIIIllIIlIlll for lllllIlIIIIlIllI in IlllIlIIlIIIIII])
        if IllIlIIllI > IlllIllllllIlIllIIl:
            return lllllIlllllllllll
        if IllIlIIllI == IlllIllllllIlIllIIl:
            if IlllIllII.IIlIlIIlllII:
                return IIIIIIllIIlIlll
            else:
                return lllllIlllllllllll
        return IIIIIIllIIlIlll
class IlIIIIIIlIIIIlIIIlI(IIlIIIIlllllI):
    IIlIIIllIllIIlll = "strategy"
    def __init__(IlllIllII, IIlIlIlIIl: Union[int, float] = float("inf")) -> None:
        super().__init__(IIlIlIlIIl=IIlIlIlIIl, IIlIlIIlllII=False)
class IlIIlllIIIlIllIllll(IlIIIIIIlIIIIlIIIlI):
    IIlIIIllIllIIlll = "strategy"
    IlIIIIlllllllIIllI = copy.copy(IIlIIIIlllllI.IlIIIIlllllllIIllI)
    IlIIIIlllllllIIllI["memory_depth"] = 5
    def __init__(IlllIllII) -> None:
        super().__init__(IIlIlIlIIl=5)