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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: D = None
        self.u: C = None
        self.txt = txt

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

j.r = a
j.p = d
e.t = l
e.s = j
a.q = l
m.y = f
m.z = f
m.s = n
m.w = l
l.v = a
l.u = a
l.q = n
b.r = a
b.p = n
d.y = e
d.z = e
d.s = n
d.w = l
f.t = l
f.s = b
n.y = e
n.z = e
n.s = d
n.w = l
assert d.w.q.z.s.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: D = None
        self.u: C = None
        self.txt = txt

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

j.r = a
j.p = d
e.t = l
e.s = j
a.q = l
m.y = f
m.z = f
m.s = n
m.w = l
l.v = a
l.u = a
l.q = n
b.r = a
b.p = n
d.y = e
d.z = e
d.s = n
d.w = l
f.t = l
f.s = b
n.y = e
n.z = e
n.s = d
n.w = l
assert d.w.q.z.s.r.q.txt == "l"