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

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

n = A("n")
b = B("b")
j = B("j")
a = B("a")
k = A("k")
l = B("l")
f = B("f")
m = A("m")

n.o = f
n.z = m
b.y = n
b.u = j
j.y = m
j.u = a
a.y = k
a.u = b
k.o = a
k.z = m
l.y = k
l.u = j
f.y = n
f.u = l
m.o = l
m.z = n
assert b.y.z.o.y.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: A = None
        self.txt = txt

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

n = A("n")
b = B("b")
j = B("j")
a = B("a")
k = A("k")
l = B("l")
f = B("f")
m = A("m")

n.o = f
n.z = m
b.y = n
b.u = j
j.y = m
j.u = a
a.y = k
a.u = b
k.o = a
k.z = m
l.y = k
l.u = j
f.y = n
f.u = l
m.o = l
m.z = n
assert b.y.z.o.y.z.z.z.z.txt == "n"