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

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

n = A("n")
e = B("e")
k = B("k")
m = A("m")
l = B("l")

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

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

n = A("n")
e = B("e")
k = B("k")
m = A("m")
l = B("l")

n.o = k
n.t = l
e.z = k
k.z = l
m.o = e
m.t = e
l.z = e
assert e.z.z.z.z.txt == "k"