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

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

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

j = A("j")
f = B("f")
i = C("i")

j.t = f
f.u = i
i.q = j
i.z = f
assert j.t.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

j = A("j")
f = B("f")
i = C("i")

j.t = f
f.u = i
i.q = j
i.z = f
assert j.t.u.q.txt == "j"