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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.w: B = None
        self.x: A = None
        self.txt = txt

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

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

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

d = A("d")
e = B("e")
c = C("c")
g = D("g")
h = E("h")
m = B("m")

d.v = g
d.y = g
d.u = c
e.r = g
e.p = g
e.w = m
e.x = d
c.s = e
g.s = h
h.z = m
h.w = g
h.o = g
h.v = d
h.r = e
m.r = g
m.p = g
m.w = e
m.x = d
assert m.w.p.s.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: D = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.w: B = None
        self.x: A = None
        self.txt = txt

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

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

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

d = A("d")
e = B("e")
c = C("c")
g = D("g")
h = E("h")
m = B("m")

d.v = g
d.y = g
d.u = c
e.r = g
e.p = g
e.w = m
e.x = d
c.s = e
g.s = h
h.z = m
h.w = g
h.o = g
h.v = d
h.r = e
m.r = g
m.p = g
m.w = e
m.x = d
assert m.w.p.s.z.w.txt == "e"