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

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

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

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

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

f = A("f")
c = B("c")
j = C("j")
m = D("m")
b = E("b")
e = A("e")
d = E("d")
a = B("a")
n = C("n")

f.w = a
f.z = n
f.s = d
c.s = f
c.p = b
c.q = e
j.q = c
j.u = c
j.s = b
j.w = n
m.o = j
b.s = m
b.r = n
e.w = a
e.z = n
e.s = d
d.s = m
d.r = n
a.s = f
a.p = b
a.q = e
n.q = a
n.u = c
n.s = d
n.w = j
assert d.s.o.s.r.u.q.z.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: C = None
        self.s: E = None
        self.txt = txt

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

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

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

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

f = A("f")
c = B("c")
j = C("j")
m = D("m")
b = E("b")
e = A("e")
d = E("d")
a = B("a")
n = C("n")

f.w = a
f.z = n
f.s = d
c.s = f
c.p = b
c.q = e
j.q = c
j.u = c
j.s = b
j.w = n
m.o = j
b.s = m
b.r = n
e.w = a
e.z = n
e.s = d
d.s = m
d.r = n
a.s = f
a.p = b
a.q = e
n.q = a
n.u = c
n.s = d
n.w = j
assert d.s.o.s.r.u.q.z.w.s.txt == "b"