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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: B = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

j = A("j")
h = B("h")
e = C("e")
c = D("c")

j.v = c
j.w = h
h.w = c
h.x = e
e.w = c
e.r = c
e.t = h
c.z = e
assert c.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: B = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

j = A("j")
h = B("h")
e = C("e")
c = D("c")

j.v = c
j.w = h
h.w = c
h.x = e
e.w = c
e.r = c
e.t = h
c.z = e
assert c.z.w.z.txt == "e"