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

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

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

k = A("k")
d = B("d")
e = C("e")

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

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

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

k = A("k")
d = B("d")
e = C("e")

k.z = e
k.r = e
k.w = d
d.v = k
e.q = d
e.u = d
assert k.w.v.r.txt == "e"