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

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

e = A("e")
l = B("l")
i = B("i")
b = A("b")
m = B("m")
k = B("k")
f = B("f")
d = B("d")
j = A("j")
n = A("n")

e.v = j
e.u = j
l.p = k
i.p = l
b.v = e
b.u = e
m.p = l
k.p = i
f.p = k
d.p = i
j.v = b
j.u = b
n.v = j
n.u = j
assert e.u.u.v.v.u.u.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.txt = txt

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

e = A("e")
l = B("l")
i = B("i")
b = A("b")
m = B("m")
k = B("k")
f = B("f")
d = B("d")
j = A("j")
n = A("n")

e.v = j
e.u = j
l.p = k
i.p = l
b.v = e
b.u = e
m.p = l
k.p = i
f.p = k
d.p = i
j.v = b
j.u = b
n.v = j
n.u = j
assert e.u.u.v.v.u.u.v.v.v.v.txt == "j"