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

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

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

m = A("m")
f = B("f")
k = C("k")
b = B("b")

m.z = k
m.s = k
f.y = m
f.r = k
k.u = m
k.o = m
b.y = m
b.r = k
assert m.s.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: C = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
k = C("k")
b = B("b")

m.z = k
m.s = k
f.y = m
f.r = k
k.u = m
k.o = m
b.y = m
b.r = k
assert m.s.u.z.txt == "k"