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

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

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

c = A("c")
i = B("i")
h = C("h")
k = B("k")
g = A("g")
e = B("e")
l = C("l")
m = B("m")
d = A("d")
f = C("f")

c.u = f
c.s = h
i.z = h
i.s = f
h.p = l
k.z = l
k.s = f
g.u = l
g.s = f
e.z = h
e.s = f
l.p = h
m.z = h
m.s = f
d.u = f
d.s = h
f.p = l
assert m.z.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: C = None
        self.txt = txt

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

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

c = A("c")
i = B("i")
h = C("h")
k = B("k")
g = A("g")
e = B("e")
l = C("l")
m = B("m")
d = A("d")
f = C("f")

c.u = f
c.s = h
i.z = h
i.s = f
h.p = l
k.z = l
k.s = f
g.u = l
g.s = f
e.z = h
e.s = f
l.p = h
m.z = h
m.s = f
d.u = f
d.s = h
f.p = l
assert m.z.p.p.p.txt == "l"