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

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

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

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

h = A("h")
m = B("m")
j = C("j")
a = D("a")
i = D("i")
k = C("k")
e = D("e")

h.z = m
m.t = k
m.z = i
j.q = m
j.o = m
j.w = h
j.s = a
a.o = e
a.u = h
a.s = m
a.r = m
i.o = a
i.u = h
i.s = m
i.r = m
k.q = m
k.o = m
k.w = h
k.s = i
e.o = i
e.u = h
e.s = m
e.r = m
assert i.s.z.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

h = A("h")
m = B("m")
j = C("j")
a = D("a")
i = D("i")
k = C("k")
e = D("e")

h.z = m
m.t = k
m.z = i
j.q = m
j.o = m
j.w = h
j.s = a
a.o = e
a.u = h
a.s = m
a.r = m
i.o = a
i.u = h
i.s = m
i.r = m
k.q = m
k.o = m
k.w = h
k.s = i
e.o = i
e.u = h
e.s = m
e.r = m
assert i.s.z.s.z.s.txt == "m"