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

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

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

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

d.s = g
d.z = e
d.q = e
g.y = d
e.o = g
e.u = d
assert e.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: C = None
        self.q: C = None
        self.txt = txt

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

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

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

d.s = g
d.z = e
d.q = e
g.y = d
e.o = g
e.u = d
assert e.u.q.u.txt == "d"