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

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

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

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

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

i = A("i")
j = B("j")
m = C("m")
e = D("e")
k = E("k")
h = B("h")
c = B("c")
l = B("l")
n = C("n")

i.y = n
i.q = k
i.p = e
j.z = c
m.s = h
e.w = k
e.u = k
e.o = i
k.r = n
h.z = c
c.z = h
l.z = c
n.s = c
assert k.r.s.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
m = C("m")
e = D("e")
k = E("k")
h = B("h")
c = B("c")
l = B("l")
n = C("n")

i.y = n
i.q = k
i.p = e
j.z = c
m.s = h
e.w = k
e.u = k
e.o = i
k.r = n
h.z = c
c.z = h
l.z = c
n.s = c
assert k.r.s.z.z.z.z.z.txt == "h"