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

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

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

b = A("b")
d = B("d")
e = C("e")
m = A("m")
l = C("l")
j = B("j")
i = C("i")
c = B("c")
h = A("h")

b.s = i
d.s = j
e.z = b
e.o = m
m.s = e
l.z = m
l.o = h
j.s = c
i.z = m
i.o = m
c.s = d
h.s = i
assert j.s.s.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

b = A("b")
d = B("d")
e = C("e")
m = A("m")
l = C("l")
j = B("j")
i = C("i")
c = B("c")
h = A("h")

b.s = i
d.s = j
e.z = b
e.o = m
m.s = e
l.z = m
l.o = h
j.s = c
i.z = m
i.o = m
c.s = d
h.s = i
assert j.s.s.s.s.s.s.s.s.s.txt == "j"