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

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

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

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

m = A("m")
k = B("k")
a = C("a")
c = D("c")
l = A("l")

m.x = a
k.r = a
k.t = a
k.o = a
k.y = c
a.z = k
a.p = c
a.v = m
c.w = a
c.s = l
l.x = a
assert c.w.p.s.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

m = A("m")
k = B("k")
a = C("a")
c = D("c")
l = A("l")

m.x = a
k.r = a
k.t = a
k.o = a
k.y = c
a.z = k
a.p = c
a.v = m
c.w = a
c.s = l
l.x = a
assert c.w.p.s.x.z.txt == "k"