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

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

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

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

f.t = n
e.v = l
h.x = n
k.x = h
a.t = k
m.v = a
l.t = k
n.x = h
assert m.v.t.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

f.t = n
e.v = l
h.x = n
k.x = h
a.t = k
m.v = a
l.t = k
n.x = h
assert m.v.t.x.x.x.x.x.txt == "h"