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

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

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

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

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

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

n.s = m
n.q = j
n.z = c
c.z = e
c.r = k
c.o = h
e.o = m
e.z = c
e.w = n
h.t = c
h.v = c
h.r = e
h.z = n
k.y = e
k.o = e
k.z = c
j.s = m
j.q = n
j.z = c
m.y = e
m.o = e
m.z = c
assert e.z.z.o.z.r.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: A = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

n.s = m
n.q = j
n.z = c
c.z = e
c.r = k
c.o = h
e.o = m
e.z = c
e.w = n
h.t = c
h.v = c
h.r = e
h.z = n
k.y = e
k.o = e
k.z = c
j.s = m
j.q = n
j.z = c
m.y = e
m.o = e
m.z = c
assert e.z.z.o.z.r.z.z.txt == "e"