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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: D = None
        self.t: D = None
        self.w: B = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: D = None
        self.t: D = None
        self.w: B = None
        self.u: C = None
        self.txt = txt

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

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

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

m.q = e
m.r = h
d.q = a
d.t = k
d.u = m
d.z = m
d.y = h
j.q = m
j.z = a
j.t = a
j.w = d
j.u = n
b.z = d
b.w = h
e.q = a
e.u = k
e.o = c
e.z = d
e.w = j
c.q = b
c.t = n
c.u = m
c.z = m
c.y = h
n.q = m
n.z = b
n.t = b
n.w = d
n.u = j
h.q = b
h.t = j
h.u = m
h.z = m
h.y = c
k.q = m
k.z = a
k.t = a
k.w = c
k.u = j
a.z = h
a.w = d
assert m.r.y.t.u.w.t.u.u.u.txt == "j"