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

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

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

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

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

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

n.v = l
n.u = h
d.u = g
d.z = g
g.v = n
g.u = i
i.u = l
i.z = n
k.u = g
k.z = g
e.u = n
e.z = n
l.v = g
l.u = j
j.u = n
j.z = n
h.u = n
h.z = n
assert l.v.u.u.u.u.v.u.txt == "j"