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

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

m = A("m")
e = B("e")
n = B("n")
j = B("j")
k = B("k")
h = A("h")
l = B("l")
f = B("f")

m.z = k
m.o = f
e.s = m
n.s = h
j.s = h
k.s = m
h.z = e
h.o = l
l.s = m
f.s = m
assert l.s.z.s.o.s.o.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: B = None
        self.txt = txt

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

m = A("m")
e = B("e")
n = B("n")
j = B("j")
k = B("k")
h = A("h")
l = B("l")
f = B("f")

m.z = k
m.o = f
e.s = m
n.s = h
j.s = h
k.s = m
h.z = e
h.o = l
l.s = m
f.s = m
assert l.s.z.s.o.s.o.s.z.txt == "k"