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

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

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

class D:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: B = None
        self.z: D = None
        self.u: B = None
        self.x: A = None
        self.txt = txt

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

h = A("h")
a = B("a")
j = C("j")
m = D("m")
b = E("b")
e = D("e")

h.z = e
a.y = m
j.o = e
j.v = e
j.y = e
m.v = e
m.z = e
m.p = a
m.u = a
m.x = h
b.s = j
b.v = j
e.v = m
e.z = m
e.p = a
e.u = a
e.x = h
assert h.z.z.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: B = None
        self.z: D = None
        self.u: B = None
        self.x: A = None
        self.txt = txt

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

h = A("h")
a = B("a")
j = C("j")
m = D("m")
b = E("b")
e = D("e")

h.z = e
a.y = m
j.o = e
j.v = e
j.y = e
m.v = e
m.z = e
m.p = a
m.u = a
m.x = h
b.s = j
b.v = j
e.v = m
e.z = m
e.p = a
e.u = a
e.x = h
assert h.z.z.p.y.txt == "m"