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

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

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

l.t = n
l.z = e
f.x = m
m.x = i
e.x = m
n.t = l
n.z = i
k.t = l
k.z = i
a.t = l
a.z = i
i.x = f
b.t = a
b.z = f
assert a.z.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

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

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

l.t = n
l.z = e
f.x = m
m.x = i
e.x = m
n.t = l
n.z = i
k.t = l
k.z = i
a.t = l
a.z = i
i.x = f
b.t = a
b.z = f
assert a.z.x.x.txt == "m"