class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: A = None
        self.txt = txt

n = A("n")
k = B("k")
i = A("i")
l = A("l")

n.y = k
n.s = k
k.p = i
k.y = i
i.y = k
i.s = k
l.y = k
l.s = k
assert l.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: A = None
        self.txt = txt

n = A("n")
k = B("k")
i = A("i")
l = A("l")

n.y = k
n.s = k
k.p = i
k.y = i
i.y = k
i.s = k
l.y = k
l.s = k
assert l.y.y.y.txt == "k"