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

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

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

j = A("j")
l = B("l")
a = C("a")

j.z = a
j.x = a
l.p = a
l.u = a
l.t = a
a.t = l
a.q = l
a.u = l
assert l.p.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: C = None
        self.txt = txt

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

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

j = A("j")
l = B("l")
a = C("a")

j.z = a
j.x = a
l.p = a
l.u = a
l.t = a
a.t = l
a.q = l
a.u = l
assert l.p.t.p.txt == "a"