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

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

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

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

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

e = A("e")
c = B("c")
i = C("i")
m = D("m")
f = E("f")
l = C("l")
b = B("b")
k = E("k")
d = A("d")

e.q = d
c.w = b
c.p = k
c.o = m
c.v = d
i.q = m
i.t = d
i.u = f
m.s = l
m.w = i
f.t = k
f.v = k
f.r = c
f.o = m
f.s = m
l.q = m
l.t = d
l.u = k
b.w = c
b.p = k
b.o = m
b.v = e
k.t = f
k.v = f
k.r = b
k.o = m
k.s = m
d.q = e
assert d.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

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

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

e = A("e")
c = B("c")
i = C("i")
m = D("m")
f = E("f")
l = C("l")
b = B("b")
k = E("k")
d = A("d")

e.q = d
c.w = b
c.p = k
c.o = m
c.v = d
i.q = m
i.t = d
i.u = f
m.s = l
m.w = i
f.t = k
f.v = k
f.r = c
f.o = m
f.s = m
l.q = m
l.t = d
l.u = k
b.w = c
b.p = k
b.o = m
b.v = e
k.t = f
k.v = f
k.r = b
k.o = m
k.s = m
d.q = e
assert d.q.q.q.q.q.txt == "e"