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

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

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

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

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

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

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

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

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

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

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

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

m.x = d
m.t = d
m.u = l
d.x = f
d.w = m
f.r = l
f.z = m
h.z = f
h.x = f
h.v = m
l.y = f
l.s = f
l.z = m
l.p = d
l.v = h
assert h.x.r.v.z.txt == "f"