class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: C = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
d = C("d")
c = D("c")
l = D("l")

k.v = i
k.s = d
i.u = c
i.o = c
i.z = d
i.s = d
d.x = i
c.z = k
l.z = k
assert l.z.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: C = None
        self.txt = txt

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

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

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

k = A("k")
i = B("i")
d = C("d")
c = D("c")
l = D("l")

k.v = i
k.s = d
i.u = c
i.o = c
i.z = d
i.s = d
d.x = i
c.z = k
l.z = k
assert l.z.s.x.txt == "i"