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

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

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

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

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

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

n.x = a
n.w = l
n.s = j
i.y = n
i.u = j
a.p = j
j.o = n
j.u = n
j.t = n
j.w = i
l.p = a
assert n.x.p.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: E = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

n.x = a
n.w = l
n.s = j
i.y = n
i.u = j
a.p = j
j.o = n
j.u = n
j.t = n
j.w = i
l.p = a
assert n.x.p.w.u.txt == "j"