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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

a.w = i
a.s = l
c.w = d
c.r = d
c.p = i
c.u = i
d.v = i
d.z = a
m.y = a
m.x = i
m.u = d
m.w = d
m.t = l
i.r = d
l.y = a
l.x = i
l.u = d
l.w = d
l.t = m
assert l.t.x.r.z.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

a.w = i
a.s = l
c.w = d
c.r = d
c.p = i
c.u = i
d.v = i
d.z = a
m.y = a
m.x = i
m.u = d
m.w = d
m.t = l
i.r = d
l.y = a
l.x = i
l.u = d
l.w = d
l.t = m
assert l.t.x.r.z.w.r.txt == "d"