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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: B = None
        self.r: B = None
        self.o: B = None
        self.z: B = None
        self.txt = txt

b = A("b")
l = B("l")
c = C("c")
h = D("h")
m = E("m")

b.s = c
b.w = m
l.v = b
c.y = b
c.s = b
c.x = h
c.u = h
h.x = c
m.y = b
m.x = l
m.r = l
m.o = l
m.z = l
assert b.s.s.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: B = None
        self.r: B = None
        self.o: B = None
        self.z: B = None
        self.txt = txt

b = A("b")
l = B("l")
c = C("c")
h = D("h")
m = E("m")

b.s = c
b.w = m
l.v = b
c.y = b
c.s = b
c.x = h
c.u = h
h.x = c
m.y = b
m.x = l
m.r = l
m.o = l
m.z = l
assert b.s.s.w.x.txt == "l"