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

class B:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: B = None
        self.txt = txt

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

l.v = i
n.w = b
n.z = b
j.v = h
b.w = d
b.z = n
e.w = b
e.z = n
d.w = n
d.z = e
i.v = h
h.v = j
k.v = j
a.v = h
assert n.z.w.w.z.w.z.z.txt == "n"