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

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

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

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

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

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

b.z = a
b.u = j
i.z = j
i.r = a
n.z = g
n.r = l
e.z = n
e.u = j
a.z = g
a.r = l
g.z = l
g.u = j
l.z = k
l.r = a
d.z = l
d.u = g
k.z = i
k.u = g
j.z = l
j.u = b
assert l.z.u.u.u.z.z.z.z.txt == "k"