class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

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

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

i.q = h
e.x = a
m.z = a
l.v = m
l.w = m
l.p = a
l.r = a
l.z = e
a.s = h
h.v = m
h.w = m
h.p = a
h.r = a
h.z = e
assert m.z.s.z.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

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

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

i.q = h
e.x = a
m.z = a
l.v = m
l.w = m
l.p = a
l.r = a
l.z = e
a.s = h
h.v = m
h.w = m
h.p = a
h.r = a
h.z = e
assert m.z.s.z.x.s.txt == "h"