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

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

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

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

e.s = m
e.z = f
d.s = m
d.r = b
n.x = f
b.x = n
a.s = d
a.z = f
l.x = f
c.s = m
c.z = n
m.s = d
m.r = b
h.s = d
h.z = b
f.x = b
assert h.z.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: C = None
        self.txt = txt

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

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

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

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