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

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

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

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

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

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

e.w = a
e.s = k
f.q = e
a.r = n
a.t = n
k.q = a
n.u = e
n.r = a
n.q = f
assert e.s.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

e.w = a
e.s = k
f.q = e
a.r = n
a.t = n
k.q = a
n.u = e
n.r = a
n.q = f
assert e.s.q.r.txt == "n"