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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: D = None
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: B = None
        self.t: E = None
        self.txt = txt

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

l = A("l")
a = B("a")
e = C("e")
i = D("i")
d = E("d")
m = B("m")
b = C("b")
g = E("g")

l.z = m
a.t = g
a.p = i
a.u = b
e.u = i
e.w = a
e.z = l
e.s = g
i.p = m
i.s = m
i.t = g
d.s = l
d.t = b
m.t = g
m.p = i
m.u = e
b.u = i
b.w = m
b.z = l
b.s = d
g.s = l
g.t = b
assert d.t.s.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: D = None
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: B = None
        self.t: E = None
        self.txt = txt

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

l = A("l")
a = B("a")
e = C("e")
i = D("i")
d = E("d")
m = B("m")
b = C("b")
g = E("g")

l.z = m
a.t = g
a.p = i
a.u = b
e.u = i
e.w = a
e.z = l
e.s = g
i.p = m
i.s = m
i.t = g
d.s = l
d.t = b
m.t = g
m.p = i
m.u = e
b.u = i
b.w = m
b.z = l
b.s = d
g.s = l
g.t = b
assert d.t.s.t.u.txt == "i"