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

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

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

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

d = A("d")
a = B("a")
b = C("b")
m = D("m")
c = B("c")
e = A("e")

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

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

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

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

d = A("d")
a = B("a")
b = C("b")
m = D("m")
c = B("c")
e = A("e")

d.o = m
d.y = e
d.z = b
d.s = a
a.z = m
a.o = m
a.y = e
a.q = c
b.t = c
b.p = c
b.w = a
b.z = a
m.t = a
c.z = m
c.o = m
c.y = d
c.q = a
e.o = m
e.y = d
e.z = b
e.s = c
assert b.p.y.s.y.o.txt == "m"