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

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

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

c = A("c")
f = B("f")
e = C("e")

c.x = e
c.w = e
c.v = f
f.z = e
f.r = e
e.y = f
assert f.r.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: B = None
        self.w: C = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
e = C("e")

c.x = e
c.w = e
c.v = f
f.z = e
f.r = e
e.y = f
assert f.r.y.z.txt == "e"