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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

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

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

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

m.w = e
m.o = c
m.y = b
c.y = m
c.o = b
e.p = d
e.v = b
e.o = b
b.y = d
b.s = m
b.q = m
f.o = c
f.v = m
d.p = e
d.v = b
d.o = b
assert m.w.o.y.txt == "d"