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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

k = A("k")
i = B("i")
l = C("l")
n = D("n")
h = E("h")
a = E("a")
j = A("j")

k.w = j
k.p = i
i.o = a
i.q = a
i.s = a
l.r = i
l.y = i
l.x = i
l.q = n
n.o = i
n.u = i
n.q = i
h.z = n
a.z = n
j.w = k
j.p = i
assert j.p.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

k = A("k")
i = B("i")
l = C("l")
n = D("n")
h = E("h")
a = E("a")
j = A("j")

k.w = j
k.p = i
i.o = a
i.q = a
i.s = a
l.r = i
l.y = i
l.x = i
l.q = n
n.o = i
n.u = i
n.q = i
h.z = n
a.z = n
j.w = k
j.p = i
assert j.p.q.z.txt == "n"