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

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

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

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

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

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

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

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

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

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

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

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

m.t = n
l.p = c
l.w = h
l.r = n
c.r = m
c.y = l
c.v = l
c.z = h
c.o = n
n.r = m
n.s = m
n.v = l
n.x = c
h.z = e
h.q = l
h.x = l
e.z = h
e.q = l
e.x = l
assert e.q.p.y.w.z.z.txt == "h"