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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

d = A("d")
n = B("n")
h = C("h")
a = D("a")
m = E("m")

d.q = h
d.u = h
d.y = m
d.w = m
d.p = m
n.o = m
n.v = a
n.z = a
h.z = a
h.u = n
a.u = h
m.w = d
m.s = d
m.u = a
assert n.z.u.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: C = None
        self.y: E = None
        self.w: E = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

d = A("d")
n = B("n")
h = C("h")
a = D("a")
m = E("m")

d.q = h
d.u = h
d.y = m
d.w = m
d.p = m
n.o = m
n.v = a
n.z = a
h.z = a
h.u = n
a.u = h
m.w = d
m.s = d
m.u = a
assert n.z.u.u.z.txt == "a"