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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: A = None
        self.y: C = None
        self.r: C = None
        self.w: C = None
        self.txt = txt

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

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

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

e = A("e")
d = B("d")
g = C("g")
c = D("c")
m = E("m")

e.o = c
e.t = c
e.z = d
e.u = d
e.y = m
d.o = g
d.y = g
d.r = g
d.w = g
d.v = e
g.p = e
c.v = d
c.u = e
c.x = e
m.u = e
m.z = g
assert c.v.v.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: B = None
        self.t: D = None
        self.y: E = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.v: A = None
        self.y: C = None
        self.r: C = None
        self.w: C = None
        self.txt = txt

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

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

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

e = A("e")
d = B("d")
g = C("g")
c = D("c")
m = E("m")

e.o = c
e.t = c
e.z = d
e.u = d
e.y = m
d.o = g
d.y = g
d.r = g
d.w = g
d.v = e
g.p = e
c.v = d
c.u = e
c.x = e
m.u = e
m.z = g
assert c.v.v.y.z.txt == "g"