class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: E = None
        self.u: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

m.x = l
m.p = g
m.u = a
d.y = m
d.v = i
d.p = g
d.x = e
i.y = e
i.v = d
i.u = d
i.z = g
i.o = g
l.t = i
l.s = d
g.x = m
a.x = l
a.p = g
a.u = m
e.y = i
e.v = d
e.u = d
e.z = g
e.o = g
assert m.u.u.x.t.txt == "i"