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

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

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

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

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

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

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

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

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

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

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

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

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