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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: E = None
        self.p: 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.v: A = None
        self.u: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: E = None
        self.p: 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.v: A = None
        self.u: D = None
        self.txt = txt

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

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