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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

c = A("c")
i = B("i")
h = C("h")
j = D("j")
e = E("e")
g = B("g")
l = D("l")

c.y = g
i.z = h
i.w = j
h.w = j
j.u = i
j.r = h
j.q = h
j.w = h
e.p = h
g.z = h
g.w = j
l.u = g
l.r = h
l.q = h
l.w = h
assert l.q.w.u.w.w.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

c = A("c")
i = B("i")
h = C("h")
j = D("j")
e = E("e")
g = B("g")
l = D("l")

c.y = g
i.z = h
i.w = j
h.w = j
j.u = i
j.r = h
j.q = h
j.w = h
e.p = h
g.z = h
g.w = j
l.u = g
l.r = h
l.q = h
l.w = h
assert l.q.w.u.w.w.w.q.txt == "h"