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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: D = None
        self.x: D = None
        self.u: A = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
e = C("e")
k = D("k")

b.w = c
c.p = e
c.r = k
c.x = k
c.u = b
e.z = k
e.v = b
e.w = c
k.o = e
k.q = c
k.y = b
assert c.p.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: D = None
        self.x: D = None
        self.u: A = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
e = C("e")
k = D("k")

b.w = c
c.p = e
c.r = k
c.x = k
c.u = b
e.z = k
e.v = b
e.w = c
k.o = e
k.q = c
k.y = b
assert c.p.w.r.txt == "k"