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

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

a = A("a")
c = B("c")
e = C("e")
i = D("i")
d = E("d")

a.v = i
a.u = d
c.s = i
c.q = e
c.o = e
c.w = e
e.y = a
e.z = i
i.t = d
d.u = a
d.q = c
assert a.v.t.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

a = A("a")
c = B("c")
e = C("e")
i = D("i")
d = E("d")

a.v = i
a.u = d
c.s = i
c.q = e
c.o = e
c.w = e
e.y = a
e.z = i
i.t = d
d.u = a
d.q = c
assert a.v.t.q.o.txt == "e"