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

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

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

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

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

a = A("a")
l = B("l")
h = C("h")
d = D("d")
c = E("c")

a.w = c
a.v = c
a.z = d
l.u = c
l.q = h
h.z = a
h.w = l
h.q = d
d.w = a
d.y = c
d.o = c
d.r = l
d.u = h
c.u = d
c.x = d
c.z = l
c.v = h
c.o = h
assert d.u.w.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.v: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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

a = A("a")
l = B("l")
h = C("h")
d = D("d")
c = E("c")

a.w = c
a.v = c
a.z = d
l.u = c
l.q = h
h.z = a
h.w = l
h.q = d
d.w = a
d.y = c
d.o = c
d.r = l
d.u = h
c.u = d
c.x = d
c.z = l
c.v = h
c.o = h
assert d.u.w.q.z.txt == "a"