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

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

j = A("j")
d = B("d")
f = A("f")
i = A("i")
b = A("b")
c = A("c")
m = A("m")
l = B("l")
a = B("a")
k = A("k")

j.z = d
d.o = a
d.t = c
f.z = l
i.z = d
b.z = d
c.z = l
m.z = l
l.o = a
l.t = k
a.o = l
a.t = m
k.z = a
assert k.z.t.z.t.z.o.t.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

j = A("j")
d = B("d")
f = A("f")
i = A("i")
b = A("b")
c = A("c")
m = A("m")
l = B("l")
a = B("a")
k = A("k")

j.z = d
d.o = a
d.t = c
f.z = l
i.z = d
b.z = d
c.z = l
m.z = l
l.o = a
l.t = k
a.o = l
a.t = m
k.z = a
assert k.z.t.z.t.z.o.t.z.t.z.txt == "l"