class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: B = 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.o: C = None
        self.txt = txt

d = A("d")
l = B("l")
h = C("h")
n = C("n")
i = A("i")
c = B("c")
m = C("m")
b = A("b")
f = B("f")
a = A("a")

d.z = m
d.x = l
l.s = c
h.o = m
n.o = h
i.z = h
i.x = l
c.s = f
m.o = n
b.z = n
b.x = f
f.s = l
a.z = n
a.x = c
assert l.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: B = 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.o: C = None
        self.txt = txt

d = A("d")
l = B("l")
h = C("h")
n = C("n")
i = A("i")
c = B("c")
m = C("m")
b = A("b")
f = B("f")
a = A("a")

d.z = m
d.x = l
l.s = c
h.o = m
n.o = h
i.z = h
i.x = l
c.s = f
m.o = n
b.z = n
b.x = f
f.s = l
a.z = n
a.x = c
assert l.s.s.s.s.txt == "c"