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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: E = None
        self.w: A = None
        self.t: D = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
n = C("n")
l = D("l")
e = E("e")
k = A("k")

a.z = d
a.v = d
a.y = k
a.w = e
d.s = l
d.t = l
d.y = e
d.w = k
n.t = a
n.w = e
l.r = a
l.x = a
l.q = a
e.q = d
k.z = d
k.v = d
k.y = a
k.w = e
assert a.w.q.s.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.y: A = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: E = None
        self.w: A = None
        self.t: D = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
n = C("n")
l = D("l")
e = E("e")
k = A("k")

a.z = d
a.v = d
a.y = k
a.w = e
d.s = l
d.t = l
d.y = e
d.w = k
n.t = a
n.w = e
l.r = a
l.x = a
l.q = a
e.q = d
k.z = d
k.v = d
k.y = a
k.w = e
assert a.w.q.s.q.w.q.txt == "d"