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

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

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

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

c.t = e
i.p = e
i.r = e
i.q = e
e.q = i
e.u = i
assert e.q.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

c.t = e
i.p = e
i.r = e
i.q = e
e.q = i
e.u = i
assert e.q.p.u.txt == "i"