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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: B = None
        self.x: B = None
        self.v: E = None
        self.txt = txt

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

h.w = f
g.w = f
m.o = g
m.y = g
m.p = h
m.v = h
m.u = h
c.s = m
c.q = g
f.p = c
f.q = g
f.x = g
f.v = e
e.p = c
e.q = g
e.x = g
e.v = f
assert h.w.p.s.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: B = None
        self.x: B = None
        self.v: E = None
        self.txt = txt

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

h.w = f
g.w = f
m.o = g
m.y = g
m.p = h
m.v = h
m.u = h
c.s = m
c.q = g
f.p = c
f.q = g
f.x = g
f.v = e
e.p = c
e.q = g
e.x = g
e.v = f
assert h.w.p.s.o.w.txt == "f"