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

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

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

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

c.r = i
i.u = j
i.s = j
i.x = j
j.z = i
assert c.r.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

c.r = i
i.u = j
i.s = j
i.x = j
j.z = i
assert c.r.u.z.txt == "i"