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

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

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

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

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

e = A("e")
n = B("n")
d = C("d")
k = D("k")
a = E("a")

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

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

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

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

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

e = A("e")
n = B("n")
d = C("d")
k = D("k")
a = E("a")

e.w = n
e.t = k
n.q = d
n.o = k
n.w = a
d.s = a
d.p = k
k.r = d
a.t = d
a.y = k
assert d.p.r.p.txt == "k"