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

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

c = A("c")
b = B("b")
l = A("l")

c.z = l
c.r = b
b.u = c
l.z = c
l.r = b
assert l.z.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: B = None
        self.txt = txt

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

c = A("c")
b = B("b")
l = A("l")

c.z = l
c.r = b
b.u = c
l.z = c
l.r = b
assert l.z.r.u.txt == "c"