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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: A = None
        self.q: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: A = None
        self.q: A = None
        self.w: A = None
        self.txt = txt

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

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

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