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

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

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

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

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

a = A("a")
h = B("h")
l = C("l")
g = D("g")
m = E("m")

a.w = h
a.z = h
a.r = h
h.y = g
h.u = l
l.q = g
l.u = g
l.y = g
l.v = h
g.u = h
m.y = g
assert g.u.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: B = None
        self.r: B = None
        self.txt = txt

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

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

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

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

a = A("a")
h = B("h")
l = C("l")
g = D("g")
m = E("m")

a.w = h
a.z = h
a.r = h
h.y = g
h.u = l
l.q = g
l.u = g
l.y = g
l.v = h
g.u = h
m.y = g
assert g.u.u.q.u.txt == "h"