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

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

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

f = A("f")
l = B("l")
m = C("m")
c = B("c")

f.o = m
f.z = l
f.r = l
l.w = f
l.p = m
m.z = l
c.w = f
c.p = m
assert l.p.z.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: B = None
        self.r: B = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
m = C("m")
c = B("c")

f.o = m
f.z = l
f.r = l
l.w = f
l.p = m
m.z = l
c.w = f
c.p = m
assert l.p.z.w.o.txt == "m"