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

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: C = None
        self.v: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

k = A("k")
j = B("j")
m = C("m")
e = B("e")
c = C("c")

k.t = j
j.p = e
j.w = m
j.v = m
m.v = e
e.p = j
e.w = m
e.v = c
c.v = e
assert m.v.w.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: C = None
        self.v: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

k = A("k")
j = B("j")
m = C("m")
e = B("e")
c = C("c")

k.t = j
j.p = e
j.w = m
j.v = m
m.v = e
e.p = j
e.w = m
e.v = c
c.v = e
assert m.v.w.v.w.v.txt == "e"