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

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

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

d = A("d")
j = B("j")
n = C("n")
c = B("c")
l = C("l")
b = B("b")
k = A("k")
i = B("i")
m = A("m")
h = B("h")

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

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

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

d = A("d")
j = B("j")
n = C("n")
c = B("c")
l = C("l")
b = B("b")
k = A("k")
i = B("i")
m = A("m")
h = B("h")

d.v = l
j.t = l
n.t = k
n.v = l
c.t = n
l.t = d
l.v = n
b.t = n
k.v = l
i.t = n
m.v = n
h.t = l
assert b.t.v.t.v.txt == "l"