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

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

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

e = A("e")
l = B("l")
n = C("n")
h = A("h")
i = A("i")
m = B("m")
b = B("b")
k = A("k")

e.t = h
l.x = e
l.w = b
n.r = b
h.t = i
i.t = k
m.x = i
m.w = l
b.x = h
b.w = m
k.t = i
assert l.x.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

e = A("e")
l = B("l")
n = C("n")
h = A("h")
i = A("i")
m = B("m")
b = B("b")
k = A("k")

e.t = h
l.x = e
l.w = b
n.r = b
h.t = i
i.t = k
m.x = i
m.w = l
b.x = h
b.w = m
k.t = i
assert l.x.t.t.t.t.t.txt == "k"