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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

b = A("b")
l = B("l")
j = C("j")
m = D("m")

b.z = l
l.o = b
j.y = m
m.z = b
assert l.o.z.o.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: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

b = A("b")
l = B("l")
j = C("j")
m = D("m")

b.z = l
l.o = b
j.y = m
m.z = b
assert l.o.z.o.z.txt == "l"