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

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

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

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

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

m.v = l
m.o = l
n.u = b
b.x = l
l.z = m
assert m.o.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

m.v = l
m.o = l
n.u = b
b.x = l
l.z = m
assert m.o.z.v.txt == "l"