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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

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

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

k.q = g
g.u = d
c.w = k
c.v = g
c.o = l
e.q = a
e.w = h
e.s = g
e.y = k
e.p = d
h.y = d
f.q = m
f.w = h
f.s = g
f.y = d
f.p = k
l.w = d
l.v = g
l.o = c
d.q = g
a.q = f
a.w = h
a.s = g
a.y = d
a.p = k
m.q = e
m.w = h
m.s = g
m.y = k
m.p = k
assert a.s.u.q.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

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

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

k.q = g
g.u = d
c.w = k
c.v = g
c.o = l
e.q = a
e.w = h
e.s = g
e.y = k
e.p = d
h.y = d
f.q = m
f.w = h
f.s = g
f.y = d
f.p = k
l.w = d
l.v = g
l.o = c
d.q = g
a.q = f
a.w = h
a.s = g
a.y = d
a.p = k
m.q = e
m.w = h
m.s = g
m.y = k
m.p = k
assert a.s.u.q.u.q.u.txt == "d"