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

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

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

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

k.w = c
b.r = k
b.y = e
b.u = e
m.s = l
l.r = a
l.y = c
l.u = m
a.w = f
f.s = b
e.s = l
c.s = l
h.w = e
assert k.w.s.r.w.s.r.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

k.w = c
b.r = k
b.y = e
b.u = e
m.s = l
l.r = a
l.y = c
l.u = m
a.w = f
f.s = b
e.s = l
c.s = l
h.w = e
assert k.w.s.r.w.s.r.w.s.txt == "l"