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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

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

m.q = j
m.w = a
m.s = e
e.q = j
e.y = d
e.w = d
d.p = m
a.u = d
a.z = m
a.p = m
a.y = j
a.q = j
j.u = m
j.z = d
l.u = d
l.z = m
l.p = m
l.y = j
l.q = j
assert a.y.z.p.q.u.q.txt == "j"