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

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

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

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

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

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

b.r = l
c.v = m
c.z = h
c.w = b
m.z = e
m.t = e
m.p = l
l.o = m
h.t = m
h.u = m
h.x = c
h.v = b
e.r = l
assert m.p.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

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

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

b.r = l
c.v = m
c.z = h
c.w = b
m.z = e
m.t = e
m.p = l
l.o = m
h.t = m
h.u = m
h.x = c
h.v = b
e.r = l
assert m.p.o.t.txt == "e"