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

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

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

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

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

d = A("d")
l = B("l")
e = C("e")
h = D("h")
g = E("g")
i = B("i")
m = A("m")
c = A("c")
f = B("f")
k = E("k")

d.w = k
d.s = m
l.z = e
l.q = e
e.v = g
e.s = h
e.q = k
h.r = l
h.v = e
g.u = f
g.z = l
g.r = i
g.y = h
g.s = e
i.z = e
i.q = e
m.w = g
m.s = c
c.w = g
c.s = d
f.z = e
f.q = e
k.u = f
k.r = f
k.z = l
k.y = h
k.s = e
assert m.s.s.s.s.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: A = None
        self.txt = txt

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

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

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

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

d = A("d")
l = B("l")
e = C("e")
h = D("h")
g = E("g")
i = B("i")
m = A("m")
c = A("c")
f = B("f")
k = E("k")

d.w = k
d.s = m
l.z = e
l.q = e
e.v = g
e.s = h
e.q = k
h.r = l
h.v = e
g.u = f
g.z = l
g.r = i
g.y = h
g.s = e
i.z = e
i.q = e
m.w = g
m.s = c
c.w = g
c.s = d
f.z = e
f.q = e
k.u = f
k.r = f
k.z = l
k.y = h
k.s = e
assert m.s.s.s.s.w.y.txt == "h"