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

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

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

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

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

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

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

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

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

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

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

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

e.z = m
e.v = f
e.o = c
g.o = c
g.y = c
g.s = m
g.v = m
g.p = f
d.r = g
d.y = f
f.x = m
f.o = d
m.x = d
c.o = g
c.y = g
c.s = m
c.v = m
c.p = f
assert m.x.r.v.x.y.x.txt == "m"