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

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

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

c = A("c")
m = B("m")
a = C("a")

c.x = a
c.o = m
m.z = a
m.t = a
m.r = a
a.u = m
assert c.x.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: B = None
        self.txt = txt

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

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

c = A("c")
m = B("m")
a = C("a")

c.x = a
c.o = m
m.z = a
m.t = a
m.r = a
a.u = m
assert c.x.u.r.txt == "a"