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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: B = None
        self.z: A = None
        self.t: A = None
        self.txt = txt

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

m.v = n
h.u = l
l.z = c
l.x = h
c.p = m
c.s = l
c.v = h
c.t = h
c.w = n
n.s = l
n.x = h
n.z = m
n.t = m
assert l.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: B = None
        self.z: A = None
        self.t: A = None
        self.txt = txt

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

m.v = n
h.u = l
l.z = c
l.x = h
c.p = m
c.s = l
c.v = h
c.t = h
c.w = n
n.s = l
n.x = h
n.z = m
n.t = m
assert l.x.u.x.txt == "h"