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

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

c = A("c")
e = B("e")
m = A("m")
d = A("d")
l = B("l")
a = B("a")

c.z = a
e.r = a
m.z = e
d.z = l
l.r = a
a.r = l
assert l.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

c = A("c")
e = B("e")
m = A("m")
d = A("d")
l = B("l")
a = B("a")

c.z = a
e.r = a
m.z = e
d.z = l
l.r = a
a.r = l
assert l.r.r.r.r.r.txt == "a"