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

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

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

g = A("g")
e = B("e")
i = C("i")
b = C("b")
j = A("j")
k = C("k")
a = C("a")
d = B("d")
n = B("n")
l = A("l")

g.x = l
e.v = k
i.t = b
b.t = i
j.x = g
k.t = a
a.t = b
d.v = i
n.v = b
l.x = j
assert n.v.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
i = C("i")
b = C("b")
j = A("j")
k = C("k")
a = C("a")
d = B("d")
n = B("n")
l = A("l")

g.x = l
e.v = k
i.t = b
b.t = i
j.x = g
k.t = a
a.t = b
d.v = i
n.v = b
l.x = j
assert n.v.t.t.t.t.txt == "b"