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

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

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

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

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

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

m.y = d
m.r = l
l.s = d
l.x = d
h.y = j
h.p = d
d.w = l
d.u = j
d.z = j
j.q = l
c.y = j
c.p = d
assert m.y.u.q.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

m.y = d
m.r = l
l.s = d
l.x = d
h.y = j
h.p = d
d.w = l
d.u = j
d.z = j
j.q = l
c.y = j
c.p = d
assert m.y.u.q.x.w.txt == "l"