class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: D = None
        self.s: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

a = A("a")
j = B("j")
l = C("l")
c = D("c")
m = E("m")
k = C("k")
g = C("g")
e = E("e")
h = B("h")
d = D("d")

a.q = k
a.p = k
a.z = d
a.s = h
j.v = a
j.p = d
j.u = l
l.s = j
c.u = d
m.x = a
m.r = e
m.z = c
m.q = j
k.s = j
g.s = h
e.x = a
e.r = m
e.z = c
e.q = j
h.v = a
h.p = d
h.u = l
d.u = c
assert m.r.x.p.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: D = None
        self.s: B = None
        self.p: C = None
        self.txt = txt

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

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

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

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

a = A("a")
j = B("j")
l = C("l")
c = D("c")
m = E("m")
k = C("k")
g = C("g")
e = E("e")
h = B("h")
d = D("d")

a.q = k
a.p = k
a.z = d
a.s = h
j.v = a
j.p = d
j.u = l
l.s = j
c.u = d
m.x = a
m.r = e
m.z = c
m.q = j
k.s = j
g.s = h
e.x = a
e.r = m
e.z = c
e.q = j
h.v = a
h.p = d
h.u = l
d.u = c
assert m.r.x.p.s.u.txt == "l"