class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: B = None
        self.t: C = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

d = A("d")
b = B("b")
c = C("c")
m = D("m")
i = E("i")

d.w = m
d.u = b
d.t = c
d.q = c
b.o = i
b.x = m
b.z = c
c.y = b
m.w = i
i.x = c
i.s = m
assert m.w.s.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: B = None
        self.t: C = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

d = A("d")
b = B("b")
c = C("c")
m = D("m")
i = E("i")

d.w = m
d.u = b
d.t = c
d.q = c
b.o = i
b.x = m
b.z = c
c.y = b
m.w = i
i.x = c
i.s = m
assert m.w.s.w.x.txt == "c"