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

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

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

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

i.u = e
i.x = e
e.p = b
e.z = b
b.s = i
assert b.s.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: B = None
        self.txt = txt

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

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

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

i.u = e
i.x = e
e.p = b
e.z = b
b.s = i
assert b.s.x.p.txt == "b"