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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

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

e.o = l
m.u = h
m.y = h
l.q = e
d.z = e
d.t = e
d.s = m
d.u = m
d.x = l
h.q = m
h.v = m
h.s = e
h.r = l
assert d.s.y.r.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

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

e.o = l
m.u = h
m.y = h
l.q = e
d.z = e
d.t = e
d.s = m
d.u = m
d.x = l
h.q = m
h.v = m
h.s = e
h.r = l
assert d.s.y.r.q.o.txt == "l"