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

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

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

a = A("a")
k = B("k")
h = C("h")
m = C("m")
b = A("b")
l = A("l")
e = A("e")
i = A("i")
j = B("j")
g = B("g")

a.t = e
k.s = h
h.v = i
h.x = g
m.v = a
m.x = k
b.t = a
l.t = i
e.t = l
i.t = e
j.s = h
g.s = m
assert j.s.v.t.t.t.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.s: C = None
        self.txt = txt

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

a = A("a")
k = B("k")
h = C("h")
m = C("m")
b = A("b")
l = A("l")
e = A("e")
i = A("i")
j = B("j")
g = B("g")

a.t = e
k.s = h
h.v = i
h.x = g
m.v = a
m.x = k
b.t = a
l.t = i
e.t = l
i.t = e
j.s = h
g.s = m
assert j.s.v.t.t.t.t.t.t.t.t.txt == "l"