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

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

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

e = A("e")
a = B("a")
d = C("d")
c = C("c")
i = A("i")
f = B("f")
k = A("k")

e.z = d
a.o = f
d.s = f
d.o = a
d.z = c
c.s = f
c.o = f
c.z = d
i.z = d
f.o = a
k.z = d
assert c.z.s.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

e = A("e")
a = B("a")
d = C("d")
c = C("c")
i = A("i")
f = B("f")
k = A("k")

e.z = d
a.o = f
d.s = f
d.o = a
d.z = c
c.s = f
c.o = f
c.z = d
i.z = d
f.o = a
k.z = d
assert c.z.s.o.o.txt == "f"