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

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

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

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

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

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

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

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

a.t = l
n.u = l
n.s = l
k.q = h
h.q = k
l.u = n
l.s = n
m.t = l
assert l.u.s.s.s.s.s.txt == "l"