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

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

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

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

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

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

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

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

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

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

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

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

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