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

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

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

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

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

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

j.u = d
j.t = d
j.w = l
e.t = m
e.w = d
d.x = l
m.x = l
l.y = j
l.t = e
l.z = d
l.s = d
assert j.u.x.z.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: C = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

j.u = d
j.t = d
j.w = l
e.t = m
e.w = d
d.x = l
m.x = l
l.y = j
l.t = e
l.z = d
l.s = d
assert j.u.x.z.x.s.txt == "d"