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

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

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

g = A("g")
c = B("c")
i = C("i")
a = A("a")
b = C("b")
m = A("m")
h = B("h")
k = C("k")
n = C("n")

g.t = k
c.u = i
i.v = a
a.t = n
b.v = a
m.t = b
h.u = i
k.v = m
n.v = a
assert c.u.v.t.v.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

g = A("g")
c = B("c")
i = C("i")
a = A("a")
b = C("b")
m = A("m")
h = B("h")
k = C("k")
n = C("n")

g.t = k
c.u = i
i.v = a
a.t = n
b.v = a
m.t = b
h.u = i
k.v = m
n.v = a
assert c.u.v.t.v.t.v.t.txt == "n"