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

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

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

b = A("b")
d = B("d")
n = C("n")
l = C("l")
k = A("k")
a = A("a")
j = B("j")
m = B("m")
h = A("h")

b.u = m
d.t = m
n.t = l
l.t = n
k.u = d
a.u = m
j.t = d
m.t = j
h.u = j
assert h.u.t.t.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

b = A("b")
d = B("d")
n = C("n")
l = C("l")
k = A("k")
a = A("a")
j = B("j")
m = B("m")
h = A("h")

b.u = m
d.t = m
n.t = l
l.t = n
k.u = d
a.u = m
j.t = d
m.t = j
h.u = j
assert h.u.t.t.t.t.t.t.t.t.txt == "m"