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

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

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

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

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

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

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

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

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

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

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

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

g.w = l
e.r = a
e.z = m
e.q = m
k.p = d
k.u = e
k.y = n
k.s = m
k.o = m
a.w = d
i.t = e
i.v = d
i.z = d
i.s = d
i.u = m
m.t = n
m.v = d
m.u = i
m.z = a
m.s = a
l.w = g
n.r = d
n.z = i
n.q = m
j.p = a
j.u = n
j.y = e
j.s = i
j.o = m
d.w = a
assert n.q.s.w.txt == "d"