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

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

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

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

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

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

d.r = e
d.o = e
d.v = e
d.z = a
a.x = b
a.w = b
a.o = e
a.q = e
a.s = g
g.y = l
g.s = d
e.o = g
e.v = d
b.o = d
b.x = d
l.y = g
l.s = d
assert e.v.v.v.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.z: B = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

d.r = e
d.o = e
d.v = e
d.z = a
a.x = b
a.w = b
a.o = e
a.q = e
a.s = g
g.y = l
g.s = d
e.o = g
e.v = d
b.o = d
b.x = d
l.y = g
l.s = d
assert e.v.v.v.z.q.txt == "e"