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

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

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

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

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

a = A("a")
e = B("e")
j = C("j")
d = D("d")
n = E("n")
b = C("b")
c = C("c")
f = B("f")
m = B("m")
h = C("h")

a.p = n
a.z = n
a.s = e
a.w = d
e.z = n
e.q = n
e.s = f
j.y = a
j.z = c
d.y = n
d.v = h
n.u = a
n.o = a
n.r = a
n.x = m
b.y = a
b.z = c
c.y = a
c.z = j
f.z = n
f.q = n
f.s = m
m.z = n
m.q = n
m.s = e
h.y = a
h.z = c
assert h.z.z.y.s.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: E = None
        self.s: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

a = A("a")
e = B("e")
j = C("j")
d = D("d")
n = E("n")
b = C("b")
c = C("c")
f = B("f")
m = B("m")
h = C("h")

a.p = n
a.z = n
a.s = e
a.w = d
e.z = n
e.q = n
e.s = f
j.y = a
j.z = c
d.y = n
d.v = h
n.u = a
n.o = a
n.r = a
n.x = m
b.y = a
b.z = c
c.y = a
c.z = j
f.z = n
f.q = n
f.s = m
m.z = n
m.q = n
m.s = e
h.y = a
h.z = c
assert h.z.z.y.s.z.x.txt == "m"