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

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

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

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

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

f = A("f")
a = B("a")
e = C("e")
h = D("h")
m = E("m")
l = E("l")

f.y = h
f.z = e
f.w = a
a.p = m
e.v = m
e.o = f
h.p = e
h.t = f
m.z = f
m.x = f
m.v = f
m.t = f
m.u = h
l.z = f
l.x = f
l.v = f
l.t = f
l.u = h
assert h.p.v.z.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

f = A("f")
a = B("a")
e = C("e")
h = D("h")
m = E("m")
l = E("l")

f.y = h
f.z = e
f.w = a
a.p = m
e.v = m
e.o = f
h.p = e
h.t = f
m.z = f
m.x = f
m.v = f
m.t = f
m.u = h
l.z = f
l.x = f
l.v = f
l.t = f
l.u = h
assert h.p.v.z.w.p.txt == "m"