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

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

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

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

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

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

n.p = j
i.y = a
a.q = n
a.z = n
a.w = n
a.y = n
a.o = i
d.y = i
j.v = a
j.o = d
j.s = n
l.y = i
assert l.y.y.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

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

n.p = j
i.y = a
a.q = n
a.z = n
a.w = n
a.y = n
a.o = i
d.y = i
j.v = a
j.o = d
j.s = n
l.y = i
assert l.y.y.w.p.txt == "j"