class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: E = None
        self.p: B = None
        self.q: D = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: E = None
        self.o: D = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
l = C("l")
m = D("m")
b = E("b")

a.w = d
a.p = d
a.s = b
a.q = m
a.o = m
d.u = m
d.o = m
d.x = m
d.r = b
d.s = a
l.t = d
l.q = d
l.p = a
m.z = d
b.o = a
b.r = l
b.q = d
assert a.p.s.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: E = None
        self.p: B = None
        self.q: D = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: E = None
        self.o: D = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
l = C("l")
m = D("m")
b = E("b")

a.w = d
a.p = d
a.s = b
a.q = m
a.o = m
d.u = m
d.o = m
d.x = m
d.r = b
d.s = a
l.t = d
l.q = d
l.p = a
m.z = d
b.o = a
b.r = l
b.q = d
assert a.p.s.s.q.txt == "d"