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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.y: A = None
        self.u: D = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.y: A = None
        self.u: D = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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