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

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

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

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

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

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

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