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

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

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

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

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

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

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

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

f.y = e
f.q = b
e.w = f
e.z = b
b.v = f
b.x = f
b.u = f
assert e.z.u.y.txt == "e"