class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
f = C("f")
e = B("e")
j = C("j")

d.r = e
d.z = j
b.v = f
f.s = j
f.w = j
f.u = e
e.v = j
j.s = f
j.w = f
j.u = b
assert e.v.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
f = C("f")
e = B("e")
j = C("j")

d.r = e
d.z = j
b.v = f
f.s = j
f.w = j
f.u = e
e.v = j
j.s = f
j.w = f
j.u = b
assert e.v.s.s.txt == "j"